Changing IIS6 Site Home Directory with Powershell

后端 未结 1 963
梦毁少年i
梦毁少年i 2020-12-23 23:50

I\'m trying to change a site\'s home directory using powershell. This is what I have so far, but it isn\'t saving the changes...

$server = \"localhost\"
$sit         


        
相关标签:
1条回答
  • 2020-12-24 00:31
    $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()
    
    0 讨论(0)
提交回复
热议问题