Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 144140

Re: How to find the storage of a VM in Cloud director

$
0
0

I'm trying to follow this thread but am not grasping the XML schema extension. I understand the ExtensionData.GetVirtualHardwareSection but that only provides allocated storage. I'm trying to produce a report that included used disk space on all virtual disk per VM. This may be a dumb question but I'm wondering if it possible to use both standard PowerCLI cmdlets and vCloud cmdlets in the same script. Although get-civm | get-ciview and get-vm are very similar, get-vm has the ability to pull in UsedSpaceGB whereas get-civm does not. Since this is the case and I cannot figure out the XML schema extension, I thought it might possible to combine the two in a report. I've tried the script below but I'm getting a pipelining error.

 

 

$HostReport = @()

Get-CIVM | sort-object name | foreach ($_.name){

$Report = "" | select Hostname, Org, OrgVdc, Status, CpuCount, MemoryMB, Status, ProvisionedSpaceGB, UsedSpaceGB

$Report.Hostname = $_.Name

$report.Org = $_.Org

$report.OrgVdc = $_.OrgVdc

$report.Status = $_.Status

$report.CpuCount = $_.CpuCount

$report.MemoryMB = $_.MemoryMB

$report.Status = $_.Status

$report.ProvisionedSpaceGB = ($_|Get-VM).ProvisionedSpaceGB

$report.UsedSpaceGB = ($_|Get-VM).UsedSpaceGB

$HostReport += $Report

}

$HostReport | Export-Csv -Path c:\TEMP\vm-hw.csv -NoTypeInformation -UseCulture

 

Does anyone see any issues with the script or trying to combine get-civm and get-vm?


Viewing all articles
Browse latest Browse all 144140

Trending Articles