View Get Storage Total.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 $vm.name | get-harddisk | Select-Object CapacityGB | Measure-Object CapacityGB -Sum | |
$totaldiskgb += $disksum.sum | |
} | |
$gb = ($totaldiskgb | measure-object -sum).sum | |
Write-host " Total Size $t GB" |