Skip to content
This repository was archived by the owner on Jun 12, 2023. It is now read-only.
This repository was archived by the owner on Jun 12, 2023. It is now read-only.

Import-Module IISAdministration Fails With "Could not load file or assembly 'Microsoft.Web.Administration..." #25

@tparikka

Description

@tparikka

Steps to reproduce

On Windows, run the following script in PowerShell 7.2.1:

Install-Module -Name IISAdministration
Import-Module IISAdministration
Get-Module -ListAvailable

Expected behavior

The import should succeed and the module should be listed:

Script     1.1.0.0               IISAdministration                   Core,Desk {Get-IISServerManager, Set-IISConfigAtt…

Actual behavior

The import fails with the following error:

Import-Module: Could not load file or assembly 'Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.

The system cannot find the file specified.

The Get-Module list shows no cmdlets associated with IISAdministration:

Script     1.1.0.0               IISAdministration                   Core,Desk

Environment data

On the machine exhibiting the problem behavior:

PS C:\Users\thoma> $PSVersiontable

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.19044
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

On the machine working successfully:

PS C:\Users\thomas.parikkaADM> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Microsoft Windows 10.0.19042
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

I have confirmed on a VM running 19042 that the Windows 10 build is not a factor as far as I can tell, because on a 20H2 VM I still see the problem behavior. I have also enabled IIS Management Console and IIS Management Scripts and Tools. The bulk of the documentation I could find referred to earlier versions of PowerShell 7 not supporting IISAdministration, but this doesn't seem to apply to 7.2.1 - if it did globally, I wouldn't have myself and multiple other team members running the scripts with no issues. I appreciate any help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions