Managing System Services using PowerShell

You can manage system services in local or remote computers using PowerShell. PowerShellprovides you set of cmdlets to work with system services. They are;

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

Let’s consider a simple scenario – you need to stop the SQLBrowser service running in a remote computer. The below statement above get the SQLBrowser service in remote computer, Susantha-lp and stores in a variable called “$s”

$s = Get-Service -Name SQLBrowser -ComputerName susantha-lp

The next step  is to stop the service.  There are two different methods available for doing this:

  1. You can use Stop-Service cmdlet or
  2. You can invoke stop() method in “$s” object

The first method of stopping the service can be achieved using the below code:

$s | Stop-Service

The second method is:


Both methods are really simple. My preference would be for the second method due to its object oriented approach.Continues…

Leave a Reply

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


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>