Cloud PHD

Quick script to get the total size of a VM

Quick script to get the total size of a VM

Here is a quick script I threw together to help calculate backup schedules.

# get total hard disk for a specific vm in GB
Write-Host ""
Write-host "CALCULATE TOTAL DRIVE SPACE OF ALL VMDK'S FOR A VM" -foregroundcolor "red"
Write-Host ""
$vmname = Read-Host "What is the name of your VM?"
(Get-VM -name $vmname | Get-HardDisk | Measure-Object -Property CapacityKB -Sum).sum/(1024*1024)

get_total_drive

Leave a Reply

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