gpt4 book ai didi

iis - 使用Powershell更改IIS6站点主目录

转载 作者:行者123 更新时间:2023-12-04 13:45:47 24 4
gpt4 key购买 nike

我正在尝试使用Powershell更改站点的主目录。到目前为止,这是我所拥有的,但是并没有保存更改。

$server = "localhost"
$siteName = "mysite"
$iis = [ADSI]"IIS://$server/W3SVC"
$site = $iis.psbase.children | where { $_.keyType -eq "IIsWebServer"
-AND $_.ServerComment -eq $siteName }
$path = [adsi]($site.psbase.path+"/ROOT")

$path.path = "D:\Sites\mysite\www2"
$site.psbase.CommitChanges()

最佳答案

$server = "localhost"
$siteName = "mysite"
$iis = [ADSI]"IIS://$server/W3SVC"
$site = $iis.psbase.children | where { $_.keyType -eq "IIsWebServer"
-AND $_.ServerComment -eq $siteName }
$path = [adsi]($site.psbase.path+"/ROOT")
$path.path
$path.psbase.properties.path[0] = "D:\Sites\$siteName\www2"
$path.path
$path.psbase.CommitChanges()

关于iis - 使用Powershell更改IIS6站点主目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/330608/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com