Menu

Virtual Geek

Tales from real IT system administrators world and non-production environment

Powershell New-Object Retrieving the COM class factory for component with CLSID 80040154 Class not registered (Exception from HRESULT 0x80040154 (REGDB_E_CLASSNOTREG))

I was trying to use PowerShell object InternetExplorer.Application for automation purpose, While running my Powershell scripts on my VMs, I was receiving below error. To troubleshoot further I tested other Microsoft object for example: Excel.Application and Outlook.Application. Still I was receiving the same error. I tested same script on Windows 10 laptop and it was working fine.

$ieObject = New-Object -ComObject "InternetExplorer.Application"

New-Object : Retrieving the COM class factory for component with CLSID {00000000-0000-0000-0000-000000000000} failed due to the following error:
80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).
At line:1 char:13
+ $ieObject = New-Object -ComObject "InternetExplorer.Application"
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [New-Object], COMException
    + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand

Microsoft Powershell new-Object -comobject internetExplorer.Application excel.application outlook.application retriving the com class facttory for component with CLSID class not registered.png

After few testing I came to conclusion neither Internet Explorer is installed on my system nor Microsoft office applications. (Internet Explorer was removed with hardening), For office application I verified under programs and applications. I can also verify it with below commands whether those .net object assemblies are available.

[System.AppDomain]::CurrentDomain.GetAssemblies()
Get-ChildItem HKLM:\Software\Classes | Select-Object -ExpandProperty PSChildName | where-Object {$_ -eq 'InternetExplorer.Application'}
Get-ChildItem HKLM software classes select-Object -expandProperty pschildname where-Object internetexplorer.application assemblies.png

Resolution
To resolve this issue you will need to Install those applications on your Operating system so assemblies and classes are exposed to Powershell.

Useful Articles
PowerShell Convert MAC address to Link-local address IPv6
PowerShell Invoke-WebRequest The request was aborted Could not create SSL TLS secure channel
PowerShell Invoke-WebRequest The underlying connection was closed: Could not establish trust relationship for the SSL TLS secure channel.
Powershell Write-Eventlog The source name test does not exist on computer localhost

Go Back

Comment

Blog Search

Page Views

11385407

Follow me on Blogarama