Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#Create a CSV file with a Column called name containing all your VM names, 1 per line.
$vmlist = import-csv "c:\your\csv\here.csv"
$totaldiskgb = @()
foreach ($vm in $vmlist) {
$disksum = get-vm $ | get-harddisk | Select-Object CapacityGB | Measure-Object CapacityGB -Sum
$totaldiskgb += $disksum.sum
$gb = ($totaldiskgb | measure-object -sum).sum
Write-host " Total Size $t GB"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment