Retrieving the COM class factory for component with CLSID

%3CLINGO-SUB%20id%3D%22lingo-sub-2851789%22%20slang%3D%22en-US%22%3ERetrieving%20the%20COM%20class%20factory%20for%20component%20with%20CLSID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2851789%22%20slang%3D%22en-US%22%3E%3CP%3EHi%2C%3C%2FP%3E%3CP%3EI%20need%20to%20move%20an%20old%20script%20from%20old%20server%20to%20new%20one.%20Getting%20following%20error%20when%20I%20run%20below%20code.%3C%2FP%3E%3CP%3E%24file%20%3D%20New-Object%20-%20ComObject%20Excel.Application%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EError%20%3A%20New-Object%20%3A%20Retrieving%20the%20COM%20class%20factory%20for%20component%20with%20CLSID%20%7B00000000-0000-0000-0000-000000000000%7D%20failed%20due%20to%20the%20following%20error%3A%2080040154%3CBR%20%2F%3EClass%20not%20registered%20(Exception%20from%20HRESULT%3A%200x80040154%20(REGDB_E_CLASSNOTREG)).%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20tried%20installing%20Excel%20package%20for%20PowerShell.%20Can%20someone%20guide%20what%20else%20might%20be%20missing%20or%20needs%20to%20be%20installed%20since%20it's%20brand%20new%20server%3F%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThanks!%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2851789%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EWindows%20Server%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2871942%22%20slang%3D%22en-US%22%3ERe%3A%20Retrieving%20the%20COM%20class%20factory%20for%20component%20with%20CLSID%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2871942%22%20slang%3D%22en-US%22%3E%3CP%3EHello%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F1187035%22%20target%3D%22_blank%22%3E%40Newbee321%3C%2FA%3E%2C%3C%2FP%3E%3CP%3EAFAIK%20you%20need%20to%20have%20Microsoft%20Excel%20installed%20on%20the%20server%20to%20create%20a%20COM%20object.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EHope%20that%20helps.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Hi,

I need to move an old script from old server to new one. Getting following error when I run below code.

$file = New-Object - ComObject Excel.Application

 

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

 

I tried installing Excel package for PowerShell. Can someone guide what else might be missing or needs to be installed since it's brand new server?

 

Thanks! 

1 Reply

Hello @Newbee321,

AFAIK you need to have Microsoft Excel installed on the server to create a COM object.

 

Hope that helps.