I need to use the new IISAdministration PowerShell cmdlets on Windows 7 to develop and debug scripts. Since this module does not exist on Windows 7 by default, I tried to install it. For this, I installed Windows Management Framework 5.1 on to make sure that I have PowerShell 5.1 with the PowerShellGet module available.
After that, I installed the IISAdministration module using this command:
Install-Module -Name IISAdministration
It does not report any errors, but when I try to list the available modules, it does not show any cmdlets installed:
PS D:\> get-module -ListAvailable
Directory: C:\Program Files\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 1.1.0.0 IISAdministration
Binary 1.0.0.1 PackageManagement {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script 1.0.0.1 PowerShellGet {Install-Module, Find-Module, Save-Module, Update-Module...}
I can see cmdlets in the ExportedCommands column when executing this command on my production Windows Server 2012 R2 machine.
When I try to import the module in a script or directly in the PowerShell console, I am getting this error:
PS D:\> Import-Module IISAdministration
Import-Module : Could not load type 'Microsoft.Web.Administration.SslFlags' from assembly
'Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
At line:1 char:1
+ Import-Module IISAdministration
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Import-Module], TypeLoadException
+ FullyQualifiedErrorId : System.TypeLoadException,Microsoft.PowerShell.Commands.ImportModuleCommand
What's wrong with my setup and how to fix it?