Could not load file or assembly 'Microsoft.Web.Administration, Version=7.0.0.0

Abel Jojo 1 Reputation point
2022-11-11T11:05:24.11+00:00

Hi all,

I have a win server 2016 1607 Build OS 14393.14 with IIS 10.0.14
I try to run some PowerShell scripts to configure websites.
Some of those code is as below

 Stop-IISCommitDelay  
            Start-Sleep -s 10  
            Start-IISCommitDelay  
  
            $site = Get-IISSite $siteName  

While it executes, below error occurs

Get-IISSite : Could not load file or assembly 'Microsoft.Web.Administration, Version=7.0.0.0, Culture=neutral,  
PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified.  

Start-IISCommitDelay : The type initializer for 'Microsoft.IIS.Powershell.Commands.MWAMgr' threw an exception.  
At C:\Program Files (x86)\........MainScript.ps1:228 char:13  

I have tried to copy Microsoft.Web.Management and Microsoft.Web.Administration dll file from some other (win 10 LTSC) to overwrite and test is it working. Failed to overwrite since access protected, though the use has admin privileges.

This same script works on win 10 and win 2019

Thank you for your consideration and help.

Internet Information Services
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,381 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Rich Matheisen 45,091 Reputation points
    2022-11-11T15:14:35.437+00:00

    Do you find that file in the directory "C:\Windows\System32\inetsrv"? If you do, does its version match the version in the error message?

    Check the "Turn Windows features on or off" and verify that you have version 7 of the IIS Management Console installed.

    1 person found this answer helpful.

  2. Rich Matheisen 45,091 Reputation points
    2022-11-14T15:34:58.86+00:00

    In your script you specify a specific version of the DLL must be loaded. I believe that is the version delivered with IIS7. If you have IIS6 installed the DLL won't be loaded.

    0 comments No comments

  3. RIGOBERTO GONZALEZ DE JESUS 1 Reputation point
    2022-11-14T19:57:12.873+00:00

    la verdad esta buena la aplicacion

    0 comments No comments