1

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?

0

Have you installed the Remote Server Administration Tools (RSAT)?

If you do not have these tools installed, this may be your problem.

https://support.microsoft.com/en-gb/help/2693643/remote-server-administration-tools-rsat-for-windows-operating-systems

  • Thank you for your advice, but this does not help. The actual reason was in a wrong file version... – Dmitry Nikolaev May 15 '18 at 19:42
  • No problem, maybe next time ;-) Glad you got it sorted. – user236238 May 15 '18 at 23:00
0

I agree with the comment posted above by Lex Li: bringing DLLs from a newer server operating system to an older one is asking for trouble.

My website install script was built on Windows 10 and was supposed to only be used on Windows 2012 and above, but I found a Windows 2008-R2 server which needed a copy of the site and wouldn't import IISAdministration, giving the error the OP listed above.

Workaround: download and install the Carbon module.

Depending on what you need the IISAdministration module for, you may be able to find a workable substitute in the Carbon module. In my case, I was using IISAdministration solely for the Get-IISAppPool cmdlet. It turns out that Carbon has a functionally similar Get-IisAppPool cmdlet which did the job for me on Windows 2008-R2.

You can find the Carbon module by visiting the module's website. I used Chocolatey and it was a painless install.

http://get-carbon.org/about_Carbon_Installation.html

Hope this helps someone, I see the question is getting a fair number of hits.

-1

After looking deeper, I have found the actual cause of the problem. The version of the Microsoft.Web.Administration.dll assembly was wrong on my machine:

c:\Windows\assembly\GAC_MSIL\Microsoft.Web.Administration\7.0.0.0__31bf3856ad364e35\Microsoft.Web.Administration.dll

The version of this file is 6.1.7601.17514 even while the assembly version is 7.0.0.0. This file does not have the SSLFlags enum type declared and this caused the problem.

I resolved the issue by replacing this file with the file version 8.5.9600.17042 (with the same assembly version) taken from another machine.

  • blogs.iis.net/iisteam/… It is only officially supported on "Windows Server 2012 and above". So any attempt to bring it to older Windows releases is troubling yourself. – Lex Li May 16 '18 at 2:03

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.