Monthly Archives: August 2012

Using Restart-Service On A Remote Computer

I discovered the other day the Powershell command Restart-Service doesn’t allow you to restart services on a remote computer.

If you type the following command it will show you the full detailed help for the Restart-Service cmdlet:

get-help restart-service -detailed

You will notice that there is no option to specify a remote computer.  However, you can use the option -InputObject to specify another cmdlet such as Get-Service.

Restart-Service -InputObject (Get-Service -ComputerName ComputerName -name Service)

The above command uses the Get-Service cmdlet for the InputObject where ComputerName is the remote computer and Service is the service you wish to restart.

You may need to go to Control Panel / Services and open the actual service to determine the Service Name.

Using the above cmdlet in this way saved me a lot of time when using SCCM recently to develop and test a new Operating System Deployment Task Sequence.