Monday, January 19, 2009

grouping services

[] to get a report of all services and count total number of 'running' and 'stopped' status

PS> get-service | group-object status

Count Name Group
----- ---- -----
58 Stopped {System.ServiceProcess.ServiceController...}
29 Running {System.ServiceProcess.ServiceController..}

[] to show all services in the "Stopped" group

PS R:\> (get-service | group-object status)[0].group

[] to show all services in the "Running" group

PS R:\> (get-service | group-object status)[1].group

No comments:

Post a Comment