Restart Windows Services from Your Linux PC

Posted: 04/07/2010 in linux, Windows
Tags: ,

If you’ve ever wanted to remotely restart a service on your Windows PC from your Linux machine, the Command-Line fu web site has you covered with the quick and easy command to use.

In order to actually use this command, you’ll need to make sure that you have the samba-common package installed for Ubuntu, or the corresponding package for your Linux distribution. The simple sudo apt-get install samba-common command will do it for any Debian-based Linux.

Now you can list the services available on a Windows machine by using the following command, making sure to use credentials that have administrative privileges on the remote machine:
net rpc service list -I IPADDRESS -U USERNAME%PASSWORD
Once you’ve identified the service name that you want to restart, you can issue separate stop and start commands. To stop the service:
net rpc service stop SERVICENAME -I IPADDRESS -U USERNAME%PASSWORD
Then you can start the service again with the following command:
net rpc service start SERVICENAME -I IPADDRESS -U USERNAME%PASSWORD
Readers should note that a number of factors may influence whether this technique actually works—if the machine has a desktop firewall installed or the file sharing services are disabled it probably won’t work, but it’s still a very helpful technique that might come in handy.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s