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.

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
  • Thx, Don, yes, it was group, not measure, I used it somewhere and totally forgot. – Sergey Sypalo May 29 '18 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.