Thursday, March 27, 2014

Control remote services with PowerShell

Dear Readers

Have you ever become so extremely lazy that you don't even want to use RDP to logon to your server so that you can start a service on it? It might just be me then, but either way PowerShell is just a great tool for remote admin.

In order to start a service on a remote machine:

get-service -displayname *<partofservicedisplayname>* -computername <machine> | set-service -status "Running"

Obviously you can stop a service similary by setting the status to "Stopped". Please note that you can also use parameters like -name (name of service).

Also please note that the "start-service" cmdlet will try to start the service on your local machine. The set-service cmdlet seemed to have done the trick for me.


Enjoy!


Hermann

No comments:

Post a Comment