Remotely turn off and start Windows from Linux
It is now more and more becoming convenient to remotely handle daily administrative tasks from remote locations. However, there comes a time when your computer becomes unresponsive. This can be result of your computer having issues, or your computer was accidentally turned off. In any case, end result may require shutting down and restarting your computer. There are various methods to handle this. However, having a Linux server in your LAN can take care of this task quite easily.
Things to consider before this can be done. Your Linux Server will need to be resided in the same subnet. Your desktop computer will need to have Wake-On-LAN option enabled in the BIOS. Will need to install etherwake on your Linux Server (there are other software, but I’ve used this most so far and am too lazy to learn another.)
So how to shut it down?
Assuming your computer is running and on a same LAN as the Linux server, you will only need to execute following command.
net rpc shutdown –f –C “You are going down!” –I ip.address.of.desktop –U usr%passwd
That’s it. Well you can substitute “You are going down!” with any other comments and will need to substitute ip.address.of.desktop with your desktop’s ip address and usr%passwd will need to be user and password that can access the desktop. Other than that it should be fine. It worked like gravy on my work computer which is running Windows 7. I’m sure it will be fine in older version of windows as well.
Now that it’s down, how do I turn it back up?
There are few methods, but most important thing here is that your desktop’s BIOS have the WOL enabled. Also, Linux Server needs to live in the same Subnet as the Desktop Unit. You can possibly use another application, but I’m use to etherwake, so I manually downloaded from here http://packages.debian.org/lenny/i386/etherwake/download
Installation is simple and afterwards, you can run following command to start up your remote desktop.
etherwake –i eth# 00:00:00:00:00:00
You will need to substitute eth# with correct NIC device id and correct MAC address of your desktop computer. That's it!