Windows PowerShell Script: How to stop multiple windows services

If for some reason you might find yourself in the situation that you need an elegant method of stopping a bunch of windows services automagically you can always turn for help to the friendly and almighty Windows PowerShell…

# Get a list of Windows services with a specific filter criteria
$services = Get-Service |
Where-Object {$_.displayname -like "BloatedWithUselessServicesAntivirusName*"}

# Iterate through the bastard list of memory consuming services
if ($service -ne $null)
foreach ($service in $services)
# Get the service name
echo $

# Kill it with a passion or ...
Stop-Service -Name $

# Start it with hatred
#Start-Service -Name $
echo "You are in luck, you don't have crappy av installed"

PS: in case your working environments security policy is constipated administer the following pill in a ps ISE with admin rights:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.