VMware Cloud Community
justinmani
Contributor
Contributor
Jump to solution

Total GB of VM with multiple hard disks

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              

Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Use the Measure-Object cmdlet.

$harddisk | Measure-Object -Property CapacityGB -Sum | Select -ExpandProperty Sum


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

Use the Measure-Object cmdlet.

$harddisk | Measure-Object -Property CapacityGB -Sum | Select -ExpandProperty Sum


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

justinmani
Contributor
Contributor
Jump to solution

That worked!  Thanks for the quick response LucD!!

Reply
0 Kudos