October 13th, 2013

PowerTip: Use PoweShell to Start Service on Remote Machine

Doctor Scripto
Scripter

Summary: Learn how to use Windows PowerShell to start a service on a remote machine.

Hey, Scripting Guy! Question How can I start a service on a remote machine?

Hey, Scripting Guy! Answer To start a service on a local machine:

Get-Service -Name bits  | Start-service

But if you try to use the same technique on a remote machine, it tries to start the service on your local machine:

Get-Service -Name bits  -ComputerName RSLAPTOP01 | Start-service

So you have to use Set-Service:

Get-Service -Name bits -ComputerName RSLAPTOP01 | Set-Service -Status Running

Author

The "Scripting Guys" is a historical title passed from scripter to scripter. The current revision has morphed into our good friend Doctor Scripto who has been with us since the very beginning.

0 comments

Discussion are closed.