| Forum

Powershell Error: 80040154 Class not registered Exception from HRESULT

When I execute PowerShell commands, I get the below error.

Retrieving the COM class factory for component with CLSID {xxxxx-xxxx-xxxx-xxx-xxxx} failed due to the following error: 80040154 Class not 
 registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

Have anyone faced a similar issue? Kindly advise.

This is caused because of the powershell architecture. You can verify your current powershell session architecture using the below command.

if($env:PROCESSOR_ARCHITECTURE -eq "x86"){"32-Bit CPU"}Else{"64-Bit CPU"}

For 64 bit, the output will be as below.

For 32 bit, the output will be as below.

To choose between the 32 and 64-bit PowerShell, navigate to start and Windows Powershell. Windows PowerShell(x86) is for 32 bit and Windows PowerShell is for 64 bit.

Hope this helps!