VMware Cloud Community
Curdasss
Hot Shot
Hot Shot
Jump to solution

Really easy question

Hey guys I know this is a really easy thing but for some reason it's something I can't figure out. How would I go about getting just the numerical value from a measure--object command? Say I run get-vm |measure-object MemoryMB -Sum, I just want to the value for the sum not all the test that goes along with it. Is there an easy way to accomplish this? Thanks, example below:

Result:

Count : 123

Average :

Sum : 461112

Maximum :

Minimum :

Property : MemoryMB

All I want is: 461112

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

You can do

(get-vm |measure-object MemoryMB -Sum).Sum

____________

Blog: LucD notes

Twitter: lucd22


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

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

You can do

(get-vm |measure-object MemoryMB -Sum).Sum

____________

Blog: LucD notes

Twitter: lucd22


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

0 Kudos
jake_robinson_b
Hot Shot
Hot Shot
Jump to solution

This would also work:

get-vm | measure-object MemoryMB -Sum | %{$_.sum}

Jake Robinson VCP, vExpert - geekafterfive.com - Twitter: @jakerobinson
0 Kudos