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 Answers1

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
Don Zoomik
  • 1,533
  • 9
  • 14