Get Total Space Used by VMs

The other day I was in need of finding out how much space my VMs actually take up.  Below are the commands I used in the vSphere PowerCLI to get that information.

      
$TotalDisk = 0;
#Get Sum of all Disks in TBs
Get-VM | Get-HardDisk | %{$TotalDisk+=[int]$_.CapacityKB}
$TotalDisk = $TotalDisk/1024/1024/1024;
echo "$TotalDisk TBs"

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: