Get-Service Service Management With Windows Powershell From Command Line – POFTUT

Get-Service Service Management With Windows Powershell From Command Line

Windows Powershell provides easy to use commands or command-lets to manage Windows systems. Powershell can be used to manage Windows Services and provides builtin command for related operations.

Help

Help information about Powershell Services command can be get wit the following command.

Get-Service Help

Get-Service Help

List Services with Get-Service

Existing Windows services can be listed with the Powershell command Get-Service . This will list all services currently running, stopped, suspended.

List Services with Get-Service

List Services with Get-Service

While listing services information about the service state, service name and service display name will be provided in separate columns.

Only List Running Services

In previous example we simply listed services but we may need to list only running services. In order to filter running services we will use Linux grep equivalent Where-Object like below.

Only List Running Services

Only List Running Services

Start Service

One of the most used practice of service command is starting the service. Syntax of starting service command is the same we just change the Verb part of the service command and use Start-Service by providing the service name. In this example we will start the service named RasAuto .

Stop Service

Stopping a service is similar to starting we just change start to stop like below. In the example we will stop service named RasAuto

Restart Service

Restarting service is easy as starting and stopping service we will just use Restart-Service command with the service name. Restart will stop and start service if it is working. If it is not working service will just started.

Suspend Service

In Windows services can be suspended. It is similar to stopping the service but there are some differences. Suspended service will hold current situations and related data and variables. Also the service stop triggers will not run. In this example we will suspend service named MyService .

In order to suspend a service the service should support suspension. If the service do not support suspension and we try to suspend the service we will get an error like below.

Suspend Service

Suspend Service

Resume Service

Suspended service can be resumed with the Resume-Service command like below.

1 Response

  1. 13/04/2017

    […] Service Management With Windows Powershell From Command Line […]

Leave a Reply

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

Enjoy this blog? Please spread the word :)