PowerShell: Load WebAdministration in ps1 script on both IIS 7 and IIS 7.5

前端 未结 6 1688
猫巷女王i
猫巷女王i 2021-01-31 04:57

I have a PowerShell script that configures web site and web application settings in IIS. So I use the cmdlets in the WebAdministration snap in. But this script needs to run on

6条回答
  •  无人及你
    2021-01-31 05:08

    I ran into this problem today and here is solution I used

    Add-PSSnapin WebAdministration -ErrorAction SilentlyContinue

    Import-Module WebAdministration -ErrorAction SilentlyContinue

    The only situation this does not work in was if the iis powershell snapin is not installed at all.

提交回复
热议问题