This is basic sys admin 101 stuff, but it made me so happy I had to post. And who doesn’t like a little PS 101? Case in point, needed to stop and disable several services. I could open services.msc, click on each one, stop, and then disable. Or I could use Powershell.
First, we need to get the services in question. Since they all start with the same name we can use a wildcard to get all services that start with Bey. Obviously we need to use the display name of the service, the actual service name usually isn’t anything close to that.
Get-Service -DisplayName Bey*
Verify the service names in the list Powershell sends back, now let’s pipe it to the Stop-Service commandlet.
Get-Service -DisplayName Bey* | Stop-Service
And finally disable the service from starting.
Get-Service -DisplayName Bey* | Set-Service -StartupType Disabled
Using Powershell I was able to stop and disable 10 services in about 60 seconds. I didn’t have any of these commands memorized, I just knew that Powershell had a Get-Service commandlet and they have lots of Ver-Noun commandlets, so why not a Stop and Set? And if you’re not quite sure, there’s always Get-Help. I like using -ShowWindow because it pops up a neat little window and doesn’t interrupt your work flow in the PS console.
Get-Help Set-Service -ShowWindow