How to update existing IIS 6 Web Site using PowerShell

前端 未结 3 848
我在风中等你
我在风中等你 2021-02-06 11:50

I am trying to create a PowerShell script that creates a new IIS 6 web site and sets things like App Pool, Wildcard application maps, ASP.NET version, etc.

After extensi

3条回答
  •  走了就别回头了
    2021-02-06 12:04

    The $result object contains the path to the newly created IIsWebServer object. You can get access to the virtual directory, where you can configure more properties, by doing the following:

    $w3svcID = $result.ReturnValue -replace "IIsWebServer=", ""
    $w3svcID = $w3svcID -replace "'", ""
    $vdirName = $w3svcID + "/ROOT";
    
    $vdir = gwmi -namespace "root\MicrosoftIISv2" 
                 -class "IISWebVirtualDir" 
                 -filter "Name = '$vdirName'";
    # do stuff with $vdir
    $vdir.Put();
    

提交回复
热议问题