I'm trying to use the powershell cmdlet Restore-WebConfiguration on Windows Server 2016, and I'm getting this error:

PS > Restore-WebConfiguration name
get-webconfiguration : Retrieving the COM class factory for component with CLSID
{688EEEE5-6A7E-422F-B2E1-6AF00DC944A6} failed due to the following error: 80040154 Class not registered (Exception
from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
At line:1 char:1
+ get-webconfiguration /system.applicationHost/configHistory
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Get-WebConfiguration], COMException
    + FullyQualifiedErrorId : System.Runtime.InteropServices.COMException,Microsoft.IIs.PowerShell.Provider.GetConfigurationCommand

I thought I must be missing something in Add Roles and Features wizard. Or maybe there's something else that has to be done to make the cmdlet work. The Cmdlet name is clearly being FOUND, but I didn't expect this error, I expected it to work or be Not found, not to be broken like this.

IIS Management Scripts and Tools is installed.

  • Doesn't matter if I Import-Module C:\Windows\System32\WindowsPowerShell\v1.0\Modules\WebAdministration or not, still crashes. – Warren P Nov 15 '16 at 20:40

These cmdlets are only shipped as 64 bit .net assemblies. Start a 64 bit powershell and try again.

In a script that has to run on these, add something like this at the top:

if ([IntPtr]::Size -eq 4 ) {
  Write-Host "This script must be run from a 64 bit powershell."

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.