0
A
回答
-1
注:我沒有寫這個博客,但它似乎回答這樣的問題:
<# This function will set the home directory of an IIS 6 website using Powershell 2 (it will not work with v1).
You need to pass it the site description (from the Web Site tab in IIS), the new path and the server your website is running on (this can be a machine name or an IP address).
You wouldn’t believe how long it took me to get this working.
Found on: http://eliasbland.wordpress.com/2010/08/03/change-the-home-directory-of-an-iis-6-website-using-powershell-2-and-wmi/
Usage: SetHomeDirectory "mysite.co.uk" "d:\websites\mysite" "myServer"
#>
Function SetHomeDirectory($SiteDescription, $NewPath, $serverName) {
$query = "ServerComment = '" + $SiteDescription + "'"
$webserver = Get-WMIObject -class IIsWebServerSetting -namespace "root\microsoftiisv2" -Filter $query -computer $serverName -authentication 6
$nameQuery = "Name = '" + $webserver.Name + "/root'"
$webdir = Get-WMIObject -class IIsWebVirtualDirSetting -namespace "root\microsoftiisv2" -Filter $nameQuery -computer $serverName -authentication 6
$webdir.Path = $NewPath
Set-WmiInstance -InputObject $webdir
}
編輯:以鏈接複製整個腳本按照註釋
相關問題
- 1. 阿爾特通過T-SQL的所有觸發器
- 2. 阿爾特性質
- 3. 阿爾特行爲通過詳細標誌
- 4. 如何通過阿爾卡特Touch使用Adb?
- 5. 阿爾特價值ExtJS的
- 6. Mysql的阿爾特毛刺
- 7. cakePHP分頁和通過阿爾卑斯
- 8. 通過PowerShell獲取IIS日誌位置?
- 9. 阿爾特數值格式
- 10. 阿爾特情況下sentivity
- 11. 阿爾特圖像動能
- 12. 阿爾特列默認值
- 13. 阿爾特file.show()行爲
- 14. 阿爾特使用jQuery
- 15. ExtJS的:阿爾特商店的pageSize
- 16. 通過PowerShell的
- 17. 通過PowerShell的
- 18. 通過PowerShell的
- 19. 通過PowerShell的
- 20. 通過PowerShell的
- 21. 的Win32阿爾特菜單在代碼
- 22. WebBrowser控件 - 阿爾特的JavaScript
- 23. 阿爾特阿賈克斯的Json查詢參數
- 24. 通過IIS
- 25. 計算阿爾法和電源中心性通過的igraph
- 26. 通過powershell在iis中的IP地址和域名限制
- 27. 阿爾特柱下降指數
- 28. 阿爾特命名空間在Python
- 29. 阿爾特多個表列長度
- 30. 阿爾特表添加列和約束