In a previous article, I showed you how to view and kill processes on remote Windows computers.
One drawback to killing processes on a remote computer, is if the process was started by a service, once it's killed it's no longer running anymore.
NOTE: If you are unfamiliar with Windows Services, see the following article on services.
Being able to restart the service again, remotely, may be necessary with out rebooting the remote computer, especially if the service is needed by the user.
One of the best utilities to accomplish this, is to use Sysinternals PsService tool.
PsService is a service viewer and controller that allows you to connect to a remote system and stop or start services. Two things that make this utility great – it's free and requires no installation at all (yeah!).
But before you can connect to a remote system using PsService, you need to make sure ports 445 and 139 are open on the remote computer. This means, if the computer is running a firewall, or a firewall exists between your computer and the remote computer, those ports need to be open.
Also you need to use an account that has administration rights on the remote computer, that can stop and start services.
To use PsService, first download it from Microsoft's Sysinternals site (PsServices is bundled with the PsTools suite).
Next, unzip PsTools.zip and you should see the psservice.exe executable.
Now, PsService is easy to use. Say you just killed the spooler process on a remote computer because of a printing problem and need to start the spooler service.
First, open a command prompt on your computer (click Start \ Run and enter cmd in the run box) then change to the directory where you copied the psservice executable, and enter the following command at the prompt:
NOTE: The first time you use PsService, you must agree to the license agreement. To do so, just click on the Agree button.
psservice.exe \\rcomputer -u mike -p 123456 start spooler
\\rcomputer – is the name of the remote computer.
-u mike -p 123456 – is the username and password of the account that has administration rights on the remote computer.
start spooler – is the command to start the service named spooler.
After executing the command and starting the service, PsService will display the results and the state of the service, which in this case is running.
PsService can also stop services using the following command:
psservice.exe \\rcomputer -u mike -p 123456 stop spooler
One nice feature with PsService is the capability to query the list of services on the remote computer. This can be useful if need to find the service before killing a process.
To query the list of service, just use the following command:
psservice.exe \\rcomputer -u mike -p 123456 query
If you have not noticed, the list scrolls by in a hurry. To make it stop before scrolling off the screen, you can use the more command as follows:
psservice.exe \\rcomputer -u mike -p 123456 query |more
This will allow you to page through the list by pressing the space bar. If you want to quit before the end of the list, just press CTRL+C.
PsService is a great utility to add to your toolbox. One drawback to the tool that I have found is that it can be a little quirky at times. I find that it works well in a Windows domain environment or even when computers are in a workgroup. While other times it has trouble connecting.
Either way, it's a time saver that does not require any installation of remote control software.