Windows service status and how to stop and start them

We’ve all had to investigate windows service status at some point or another. There are many ways of doing this, but this is what works best for me, maybe you should try it.

PowerShell can make things easy, but complicate things at the same time. A good example of this is manipulating windows services. Run this to see the available commands for services:

You’ll get a list of commands at your disposal:

  • Get-Service
  • New-Service
  • Restart-Service
  • Resume-Service
  • Set-Service
  • Start-Service
  • Stop-Service
  • Suspend-Service

The only command I use is Get-Service and like a pro, I use its abbreviation of GSV because it’s obviously cooler if someone looks at your command and can’t immediately figure out what you’re doing…it’s like black magic.

The primary reason I like to stick to GSV is because I can use it against remote machines…I haven’t been able to figure out how to use the other commands unless I use invoke-command with a scriptblock and it just gets messy.

3 flavors of windows service status. I use [int] so that my monitoring application is happy and I can easily configure a trigger point for notifications.

Stopping and starting windows services.

Now if you wanted to get fancy with it and stop multiple services on multiple servers, you could use some foreach loop magic!

Have fun with that.

Leave a Reply