0

I've never used PowerShell measure command, but found it pretty handy and it can make my code shorter.

For now I'm looking how to get a report about VMs count and HW version they run on. Using latest gratest vCenter 6.5 U2 and PowerCLI 10.1

Output has to be like this:

 v9 | 123 v10 | 234 v11 | 345 v12 | 456 v13 | 789 

Please notice I'm trying to get this result with measure command, I know how to write a bit longer code to get the data.

1 Answer 1

0

Use Group-Object cmdlet instead. It does the heavy lifting. Example (not tested but should be correct):

Get-VM | Group-Object -Property Version | Select-Object -Property Name,Count 

Or just

Get-VM | Group-Object -Property Version -NoElement 
1
  • Thx, Don, yes, it was group, not measure, I used it somewhere and totally forgot. Commented May 29, 2018 at 9:12

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.