Iis – Powershell IIS plugin – cmdlets not working

iispowershell

I'm pretty much a novice at Powershell so bear with my noobness. I'm specifically trying to run the "Get-WebBinding" cmdlet (which I have successfully run on some of my other servers)

Windows Server 2008 R2 Standard:

Get-PsProvider

Shows the WebAdministration module is not loaded

Import-Module WebAdministration

An error occurs. "Cannot be loaded because the execution of scripts is disabled….."

Get-ExecutionPolicy

Output is "restricted"

Set-ExecutionPolicy RemoteSigned

Confirmed with a Yes.

Import-Module WebAdministration

An error occurs. "…skipped because it's already present"

Get-PsProvider

Shows that WebAdministration is now installed

Get-WebBinding (the cmdlet I really want to run)

Another error. "not found"

Any ideas why this cmdlet won't run?

Best Answer

Not sure if you managed to sort it but I do a bunch of stuff in IIS and need to run the following to enable it all:

Import-Module WebAdministration
[System.Reflection.Assembly]::LoadFrom("C:\windows\system32\inetsrv\Microsoft.Web.Administration.dll") | Out-Null
Related Topic