Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Filter services by status and name

$
0
0

I want to retrieve a list of services that are running but also want to filter out some services by name

As there are many services that I want to exclude I want to put them in an array such as:

$ServicesToIgnore = "BITS", "BFE" etc

I can do this manualy as below but am struggling to get this to work with an array.

 

 

 

 

get-service | Where-Object {$_.status -eq"Running"-and$_.name -ne"BFE" -and$_.name -ne"BITS"}

Thanks.


Viewing all articles
Browse latest Browse all 6937

Trending Articles