How to update existing IIS 6 Web Site using PowerShell

前端 未结 3 847
我在风中等你
我在风中等你 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 11:52

    This is a useful PowerShell snippet.

    I tried running this and I get problems with the delete tests. Delete does not work against the app pool when the site still exists. Surely you should run website delete test first.

    # check if web site exists and delete it - for testing purposes
    $tempWebsite  = gwmi -namespace "root\MicrosoftIISv2" 
                         -class "IISWebServerSetting" 
                         -filter "ServerComment like '%$name%'"
    if (!($tempWebsite -eq $NULL)) {$tempWebsite.delete()}
    

    Run this first, then run the app pool deletion test.
    I realise you have marked these as tests but surely it is useful to exit or delete if webs site exists.

提交回复
热议问题