Hi Community,
Really simple issue here we cannot figure out:
- Since 2015, Microsoft released this functionality and is officially documented here
- When we try to run the command in PowerShell below this is what happens:
$excel = New-Object -ComObject Excel.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)).
- CategoryInfo : ResourceUnavailable: (:) [New-Object], COMException
- FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Commands.NewObjectCommand
Troubleshooting completed:
- Tested this on other computers. It is hit or miss, about 50% of the computers work and 50% give the error message below.
- Gave users local admin rights, same issue
- Reinstalled Microsoft Office, same issue
- Ran SFC/DISM, reinstalled .NET, same issue
- If we right click PowerShell and select RUN AS ADMIN, the command works without any errors!
At this point we are stumped. All computers are on latest Windows 10 patch and are basically standard setups (no fancy configurations). I opened a ticket with Microsoft and they said to come here because they do not support PowerShell being used this way.