如何正确将 IIS6 默认站点目录 (inetpub) 迁移到另一个分区

如何正确将 IIS6 默认站点目录 (inetpub) 迁移到另一个分区

问题几乎说明了一切。我无法控制 Web 服务器的安装和配置。Inetpub 部署到了机器上的 C: 驱动器...我需要它位于 D: 上。

Sharepoint 将在此机器上运行...因此,当我完成时,IIS 需要是 koser。否则,Sharepoint 将不知道在哪里部署中央管理或任何新的站点集合。

救命!我只是个卑微的开发人员……我跪下来向服务器之神求助。

答案1

不幸的是,我在这里没有得到任何确切的答案。

幸运的是,我找到了一位 MS MVP,他发布了一个 VBScript 来帮我做这件事。我重新发布了这个脚本,因为我只能在 Google 的档案中找到它(即使这样,页面也需要很长时间才能重新加载):

' -----------------------------------------------------------------------------
' RENAME THIS FILE TO MOVEIIS.VBS BEFORE USING!!!
' -----------------------------------------------------------------------------
' Modify IIS Metabase Properties for new data location
' Change the params and params2 value depending on which components are 
' installed
' set params to 10 if NNTP and FTP are installed and running otherwise
' set params to 9 and comment out msftpsvc line if FTP is not installed
' set params2 to 4 if FTP and NNTP are installed and runnning otherwise
' set params2 to 1 and comment out cisvc, msftpsvc and nntpsvc line if the 
' Indexing service, FTP service, and Network News Transport Service are 
' not installed
' References to the Indexing service have been commented out, check comments 
' on line 75 to change Indexing Service settings


'Stop IIS services before continuing

Set WSHShell = Wscript.CreateObject("Wscript.Shell")
WSHShell.PopUp "Stopping all Internet Services..."

ret = WshShell.Run ("net stop iisadmin /y", 1, TRUE)

If ret = 0 then
 WSHShell.PopUp "IISADMIN service was stopped successfully, continuing"
 'restart()
else
 WSHShell.PopUp "IISADMIN failed to stop successfully. The error code is " & ret
 Wscript.Quit 1
end if 

Dim params(6)
Dim x, ret
Dim params2(2)

Params(0) = "w3svc/1/root/path d:\inetpub\wwwroot"
Params(1) = "w3svc/1/root/scripts/path d:\inetpub\scripts "
Params(2) = "w3svc/1/root/iissamples/path d:\inetpub\iissamples"
Params(3) = "smtpsvc/1/BadMailDirectory d:\inetpub\mailroot\BadMail"
Params(4) = "smtpsvc/1/PickupDirectory d:\inetpub\mailroot\Pickup"
Params(5) = "smtpsvc/1/QueueDirectory d:\inetpub\mailroot\Queue"
Params(6) = "smtpsvc/1/DropDirectory d:\inetpub\mailroot\Drop"
'Params(7) = "nntpsvc/1/NewsPickupDirectory d:\inetpub\nntpfile\pickup"
'Params(8) = "nntpsvc/1/NewsFailedPickupDirectory d:\inetpub\nntpfile\failedpickup"
'Params(9) = "nntpsvc/1/NewsDropDirectory d:\inetpub\nntpfile\drop"
'Params(10) = "msftpsvc/1/root/path d:\inetpub\ftproot"

Set WshSysEnv = WshShell.Environment("PROCESS")

For Each x In Params
ret = WSHShell.Run ("cscript.exe " & "c:\inetpub\adminscripts\adsutil.vbs SET " & x, 1, TRUE)
Next

' Verify Settings were successfully applied
If ret = 0 then

 WSHShell.PopUp "The new metabase settings have been successfully updated. The new Web Data path is d:\inetpub"
else
 WSHShell.PopUp "The Configuration changes failed. The error code is " & ret
 Wscript.Quit 1
end if
wscript.Sleep 5000

' Move Data to new location (D:\Inetpub) using xcopy.exe (this can be changed 
' from xcopy to move so the data is actually moved from current locale)

ret = WSHShell.Run ("xcopy c:\inetpub D:\Inetpub\ /s /e /q /i /h /r /k /o /x" , 1, TRUE)
If ret = 0 then
 WSHShell.PopUp "The data has been successfully moved to D:\Inetpub"
else
 WSHShell.PopUp "The data move failed. The error code is " & ret
 Wscript.Quit 1
end if

' INDEX SERVICE CONFIGURATION
' Remove comments from the next 29 lines to configure cisvc through this script
'
'' Update Web Catalog to be for D:\Inetpub
' 
''Stop Content Index Service
' 
'Set WSHShell = Wscript.CreateObject("Wscript.Shell")
' WSHShell.PopUp "Stopping Index Service..."
' 
'ret = WshShell.Run ("net stop cisvc", 1, TRUE)

'If ret = 0 then
' chgeCat()
'else
' WSHShell.PopUp "Content Index service failed to stop successfully. The error code is " & ret
' Wscript.Quit 1
'end if 
' 
'Function chgeCat()
'Set WshShell = WScript.CreateObject("WScript.Shell")
' 
''Delete Catalogs
'WshShell.RegDelete "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Web\"  

' Delete Web Catalog.
'WshShell.RegDelete "HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\System\"  

' Delete System Catalog.
' 
''Modify existing Web catalog entry
'WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Web\Location", "D:\Inetpub"
'WshShell.RegWrite "HKLM\SYSTEM\CurrentControlSet\Control\ContentIndex\Catalogs\Web\IsIndexingW3Svc", 1, "REG_DWORD"
' 
'end function

'Start Services (WWW, SMTP, CISVC, NNTP, MSFTPSVC)

Set WSHShell = Wscript.CreateObject("Wscript.Shell")
 WSHShell.PopUp "Attempting to restart stopped Services..."

Params2(0) = "w3svc"
Params2(1) = "smtpsvc"
'Params2(2) = "cisvc"
'Params2(3) = "nntpsvc"
'Params2(4) = "msftpsvc"

For Each x In Params2
 ret = WshShell.Run ("net start " & x, 1, TRUE)
 wscript.Sleep 5000
Next

If ret = 0 then
 WSHShell.PopUp "Services were started successfully, modifications complete"
else
 WSHShell.PopUp "One or more services fail to start successfully. The error code is " & ret
 Wscript.Quit 1
end if 

答案2

这是 IIS 6 吗?如果是,请尝试以下操作: http://thebackroomtech.com/2009/01/02/howto-move-the-windows-server-2003-inetpub-directory-from-default-directory-cinetpub-to-another-drive-letter/

此机器上已有多少个网站正在运行?您可能必须修改任何查看 c:\inetpub*** 的网站/虚拟目录的主目录

如果有帮助的话请告诉我!

答案3

如果机器上没有运行任何程序,只需删除默认站点即可。我通常会默认将其杀死。

至于 SharePoint——创建自己的站点就应该没问题。

相关内容