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
I ran into this problem today and here is solution I used
Add-PSSnapin WebAdministration -ErrorAction SilentlyContinue Import-Module WebAdministration -ErrorAction SilentlyContinue
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.