Simple VM reporting in vCloud with PowerCLI

June 11, 2013

Table of Contents

Its clear that many people are having a challenge of not having a great view of  VMs and their location in the organization. This is all due to the unique requirement of VMs to exist inside vApps in vCloud director, this can be solved with a Get-CIVM command,which returns information about your VMs, but still it’s missing the storage assignment . Here is a straightforward script to report on the VM resources currently in use inside your vCloud organization:

$vms = get-civm

$objects = @()

foreach($vm in $vms)

{

 $hardware = $vm.ExtensionData.GetVirtualHardwareSection()

 $diskMB = (($hardware.Item | where {$.resourcetype.value -eq “17”}) | %{$.hostresource[0].anyattr[0].”#text”} | Measure-Object -Sum).sum

 $row = New-Object PSObject -Property @{“vapp” = $vm.vapp; “name”=$vm.Name;”cpuCount”=$vm.CpuCount;”memoryGB”=$vm.MemoryGB;”storageGB”=($diskMB/1024)}

 $objects += $row

}

 

# Use select object to get the column order right. Sort by vApp. Force table formatting and auto-width.

$objects | select-Object name,vapp,cpuCount,memoryGB,storageGB | Sort-Object -Property vapp | Format-Table –AutoSize

This can be exported to a CSV by using Export-CSV or just run the report.  

Share on
Facebook
Twitter
LinkedIn
Pinterest
More posts

Dedicated Servers Quick Guide

What is a Dedicated Servers? Why bother using a dedicated server over a VPS or Shared Hosting?A dedicated server is a server 100% dedicated to your website/project or business needs.

Enhanced Storage Features on 5.1

Enhanced Storage Features on 5.1 SESMATEnhanced Storage features introduced by 5.1 VMFS File Sharing Limits In previous versions of vSphere, the maximum number of hosts which could share a read-only

vCloud API 5.1 Metadata

Over the years there has been a lot of changes in metadata in vCloud director,so am going to give te difference between the metadata in vCloud director 5.1 and the

Windows Update Cleanup Plugin

Here is some good news for windows 7 SP1 users and maybe for VDI admins running windows 7 desktops in their VDI environments. Windows update cleanup plugin allows to uninstall

Get 90% Discount

First 3 People gets the Bonus!
Don't Miss Out Our Big Sale

Get 0-90% On All
247Rack Services

247Rack

The Sale Is Until The End Of March