Monday, January 19, 2009

use of a pipe for plumber work?

to display only the services that are currently running

PS R:\> get-service | where-object {$_.Status -eq "Running"}

or,

PS R:\> get-service | where { $_.Status -eq "Running" }


` | ` is a pipeline operator, which passes the results to the Where-Object cmdlet, which selects the services with a Status property that equals "Running".

` -eq ` represents ' equal to '.

` Status ` is only one property of service objects.

` $_ ` is the current object operator, which indicates that the cmdlet will example the Status property of each service as it goes through the pipeline.

No comments:

Post a Comment