Over the past few months I’ve been doing a lot of work that’s required me to get into the Services control panel on Windows Server. While it’s fairly easy to get in and change the status of one service using the windows services control panel (WIN+R, Services.msc), it gets annoying when you need to do this multiple times, and even worse if you need to take action on multiple services.
Fortunately, powershell gives us the ability to do this very easily.
Here’s how:
The command below is the building block for everything else you want to do with a service. Since vendors don’t provide a standard prefix with their service names (ahem, vmware – or in this case, HP), you need to use the -DisplayName parameter of this commandlet. You can use the asterisk as a wildcard.
1 |
Get-Service -DisplayName "HP* |
Once you have a set of services, you can pipe them to another commandlet, and take action, such as stopping the service, or disabling automatic startup.
Run this command to stop the services.
1 |
Get-Service -DisplayName "HP* | Stop-Service |
Run the command below in order to disable these services from starting automatically
1 |
Get-Service -DisplayName "HP* | Set-Service -StartupType "Disabled" |