I'm running Win7 Enterprise.
My goal is to use the webadministration Powershell module with Powershell 2.0 and PowerGUI.
The module works correctly, but I get errors the next time I launch PowerGUI.
Here are the steps to reproduce the problem:
1) Open PowerGUI 3.1.0.2058.
2) Install the "webadministration" module for IIS.
I can do this with the Import-Module cmdlet or the "File > Powershell Libraries" menu item in PowerGUI.
It doesn't matter. I get the same results either way.
3) The webadministration module works as expected.
4) Quit PowerGUI.
5) Open PowerGUI.
I get a long list of error messages that seem to indicate that webadministration is causing name clashes with itself.
Example:
Import-Module : The term 'Microsoft.IIS.PowerShell.Provider\Start-WebCommitDelay' resolved to a cmdlet name that is ambiguous. Possible matches include: Microsoft.IIS.PowerShell.Provider\St art-WebCommitDelay Microsoft.IIS.PowerShell.Provider\Start-WebCommitDelay. At line:1 char:288 + @('C:\Windows\system32\WindowsPowerShell\v1.0\Modules\webadministration\Microsoft.IIS.PowerShell.Provider.dll','C:\Windows\system32\WindowsPowerShell\v1.0\Modules\webadministration\webadm inistration.psd1') | Where-Object { @(Get-Module | %{$.Path} ) -notcontains $ } | %{ Import-Module <<<< $_ } + CategoryInfo : ObjectNotFound: (Microsoft.IIS.P...-WebCommitDelay:String) [Import-Module], ParentContainsErrorRecordException + FullyQualifiedErrorId : CmdletNameAmbiguous,Microsoft.PowerShell.Commands.ImportModuleCommand
If I use Remove-Module to uninstall webadministration before quitting PowerGUI, I don't get the error messages the next time I launch PowerGUI.
Is there a rule that modules have to be uninstalled before quitting PowerGUI?
I've tried the same set of steps (don't use Remove-Module) with Microsoft's ISE and I don't have any problems there.
Where is PowerGUI remembering the import? I thought Import-Module was only per Powershell sesssion.
Please enlighten me.
Thanks!
Adam Leffert http://www.leffert.com