where-object:tldr:b26d3
where-object: Get a list of all services that are currently stopped. The `$_` automatic variable represents each object that is passed to the `Where-Object` cmdlet.
$ Get-Service | Where-Object {$_.Status -eq "Stopped"}
try on your machine
The command Get-Service
retrieves a list of all services running on a Windows computer.
The |
(pipe) symbol is used to pass the output of the Get-Service
command to the next command.
The Where-Object
cmdlet allows you to filter the output based on a specified condition. In this case, the condition is {$_Status -eq "Stopped"}
. The $_
represents the current object being processed (in this case, each service from the previous command), and Status
is a property of the service object.
So, the Where-Object
command filters the list of services from Get-Service
and returns only those services that have a status equal to "Stopped".
This explanation was created by an AI. In most cases those are correct. But please always be careful and
never run a command you are not sure if it is safe.