3

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?

  • Have you tried Add-PSSnapin WebAdministration instead? The docs suggest the Import-Module on its own may not be sufficient. – jscott Mar 10 '15 at 17:44
  • What do you get for the output of "Get-Command Get-Web*" – mortenya Mar 10 '15 at 18:59
  • Add-PSSnapin fails. It says the WebAdministration' snap-in isn't installed. (yet it seems to be installed given get-PSProvider) – Jeffmikers Mar 10 '15 at 19:14
  • Get-Command says there are no matching commands to "get-web*" – Jeffmikers Mar 10 '15 at 19:15
  • Does the problem still exist? Sounds to me as if it wasn't loaded properly due to the restrictive execution policy. Opening a new PS instance should probably fix the issue since the changed execution policy won't affect the loading of modules any longer. – megamorf Mar 22 '15 at 13:50
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.