Hi All!
This is probably an easy one. How do I get the total amount(GB) of Hard disk space of a VM with multiple disks.
I used the following to get the output.
$harddisk = get-vm vmname | get-harddisk
$harddisk.capacitygb
If the VM has 3 disks at 100GB each the output is:
100
100
100
How can I add the total of each disk and output the total?
Any help is appreciated!
-Justin
Use the Measure-Object cmdlet.
$harddisk | Measure-Object -Property CapacityGB -Sum | Select -ExpandProperty Sum
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Use the Measure-Object cmdlet.
$harddisk | Measure-Object -Property CapacityGB -Sum | Select -ExpandProperty Sum
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That worked! Thanks for the quick response LucD!!