Author Posts

January 1, 2012 at 12:00 am

by hapklaar at 2013-01-11 16:09:21

I'm looking for an easy way to measure the output of for example get-moverequest. This powershell command outputs all moverequests and their status, which is one of the following.

AutoSuspended
Completed
CompletedWithWarning
CompletionInProgress
Failed
InProgress
None
Queued
Suspended

I'd like to be able to get an output like this, so I can measure progress:

AutoSuspended 548
Completed 45
CompletedWithWarning 0
CompletionInProgress 5
Failed 1
etc.

Is this possible with measure-object, or would I need something more complex? I don't want to have to specify all possible status values to count.

by DonJ at 2013-01-15 14:50:41

Pipe to Group-Object and group on the status (or whatever other) property. Measure-Object isn't the right way to go. The resulting group objects will have a Count property.

E.g., Get-Service | Group-Object Status

by hapklaar at 2013-02-12 13:19:53

Sweet, thank you!