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.
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: