PowerCLI – VM Guest Disk Sizes

A oneline script to show the VM disk (or partiton) for each of your VM’s:

ForEach ($VM in (Get-VM |Get-View)){($VM.Guest.Disk |Select @{N=“Name“;E={$VM.Name}},DiskPath, @{N=“Capacity(MB)“;E={[math]::Round($_.Capacity/ 1MB)}}, @{N=“Free Space(MB)“;E={[math]::Round($_.FreeSpace / 1MB)}}, @{N=“Free Space %“;E={[math]::Round(((100 * ($_.FreeSpace))/ ($_.Capacity)),0)}}) | Format-Table}

Or look at the “advanced” script of virtu-al (http://www.virtu-al.net/2010/01/27/powercli-virtual-machine-disk-usage/)

One thought on “PowerCLI – VM Guest Disk Sizes

Leave a Reply

Your email address will not be published. Required fields are marked *