VMware Cloud Community
esxi1979
Expert
Expert

running powercli 5.5 path 1 on windows 2012 server

i get this error while running a script on windows 2012 server, it has, VMware vSphere PowerCLI 5.5 Release 2 Patch 1 build 1931983

During installation there were no error

The script has simple get vm cmdlets & some functions like export-xlsx etc

PowerCLI C:\powercli\scripts> .\xxx.ps1

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 C:\powercli\scripts\xxx.ps1:101 char:11

+     $xl = New-Object -ComObject Excel.Application

+           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    + CategoryInfo          : ResourceUnavailable: (:) [New-Object], COMExcept

   ion

    + FullyQualifiedErrorId : NoCOMClassIdentified,Microsoft.PowerShell.Comman

   ds.NewObjectCommand

Property 'DisplayAlerts' cannot be found on this object; make sure it exists

and is settable.

but the same works well in windows 7

In this case the line 101 is :-

$xl = New-Object -ComObject Excel.Application

3 Replies
LucD
Leadership
Leadership

This doesn't look like a PowerCLI issue.

In the PS1 script you call, you seem to create a COM object for Excel, but it looks as if Excel is not present.

What is in the script you are calling ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

esxi1979
Expert
Expert

That makes sense .. i was calling function export-xlsx  Smiley Happy

SO on local machine the xls should be present then Smiley Happy

Thanks LucD

0 Kudos
LucD
Leadership
Leadership

Yes, I'm afraid so.

As an alternative, there is a script by Peter Kriegel that doesn't need Excel to be installed, see Export-XLSX PowerShell generate real Excel XLSX files without Excel and COM


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference