Power Cli Export to Excel


I am trying to get the script below to work.

$Filename = "c:\UrgentWork\CloudStats.xlsx"
Get-OrgVdc | Select Name, `
    @{N="TotalCPUUsedGhz";E={[Math]::Round($_.CPUUsedGhz, 2)}}, `
    @{N="TotalCPULimitGhz";E={[Math]::Round($_.CPULimitGhz, 2)}} `
    | Export-Xls -Path $Filename -WorksheetName "CPUUsage" -ChartType "xlColumnClustered" -AppendWorksheet:$false
Get-OrgVdc | Select Name, `
    @{N="TotalMemUsedGB";E={[Math]::Round($_.MemoryUsedGB,2)}}, `
    @{N="TotalMemLimitGB";E={[Math]::Round($_.MemoryLimitGB, 2)}} `
    | Export-Xls -Path $Filename -WorksheetName "MemoryUsage" -ChartType "xlColumnClustered"
Get-OrgVdc | Select Name, `
    @{N="TotalStorageUsedGB";E={[Math]::Round($_.StorageUsedGB,2)}}, `
    @{N="TotalStorageLimitGB";E={[Math]::Round($_.StorageLimitGB,2)}} `
    | Export-Xls -Path $Filename -WorksheetName "StorageUsage" -ChartType "xlColumnClustered"
Get-CIUser | Select Name, `
    @{N="TotalDeployedVMs";E={$_.DeployVMCount}}, `
    @{N="TotalStoredVMs";E={$_.StoredVMCount}} `
    | Export-Xls -Path $Filename -WorksheetName "User VM Counts" -ChartType "xlColumnClustered"

Invoke-Item $Filename

I found this script here Reporting with the PowerCLI vCD Cmdlets | VMware PowerCLI Blog - VMware Blogs and think it will be useful for reporting.

I open powecli and connect to my vcentre. I then run the function script here as suggested.


After that I run the main script and get the attached error. Excel is installed on the server. Does anyone know what these errors are?

0 Kudos
0 Replies