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"
$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()
answered below..