Windows Server 2016 : using Restore-WebConfiguration

0

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.

iis
powershell
windows-server-2016
asked on Server Fault Nov 15, 2016 by Warren P

1 Answer

0

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."
  Exit
}
answered on Server Fault Nov 15, 2016 by Warren P

User contributions licensed under CC BY-SA 3.0