Shut Down Your Windows PC Remotely From Linux
If you’ve ever wanted to remotely reboot a Windows box 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 reboot a machine remotely with the following syntax, making sure to use a username that has administrative privileges on the Windows box:
net rpc shutdown -I IPADDRESS -U USERNAME%PASSWORD
If you omit the password section, you’ll be prompted on the command line for the password—which might be more secure if you are worried about somebody looking through your terminal history. You can add the -f parameter to force a shutdown, which might be necessary to make sure the remote machine actually shuts down.
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.
For more, learn how you can use the shutdown.exe GUI to turn Windows off.
Shutdown a Windows machine from Linux [Command-Line Fu]
- Next Post: Catfish Searches Your Linux Desktop »
- « Previous Post: Turn Off The Magnifier To Edit In Word 2007’s Print Preview Mode
Comments (AU Comments | US Comments)
I remember doing this at school - hilarious. Also funny to do it to idiots that leave their guest account open.
prochobo
@SamburgerHandwich: Someone's never heard of Wake-on-LAN, I see. :)
Chris Balcum
Oh, darn. I misread the headline to be "Shutdown your Windows PC PERMANENTLY from Linux".
Now that would have been news.
bradpdx
Oh yeah, let's see you start a windows machine from the command line! Then I'll be impressed.
SamburgerHandwich
Command-Line Fu is a great site, but this is hardly a profound tip.
John Allen
You can also use Remote Desktop Viewer and then go to Run>>CMD
Then in CMD you can type shutdown /s
tjl30
i was about to suggest the shutdown -i :)
@FreakinSyco:
@Sanjay: This article is about shutting down the Windows computer from a Linux box.
@HeartBurnKid: Agent of R.O.A.C.H.:
Or you could simply type "shutdown -i" in the run box and shutdown or restart as many computers as you like.
FreakinSyco
You could just do the following w/o installing anything...
shutdown -m \\computername -r -f
[see: [www.online-tech-tips.com]]
@HeartBurnKid: Agent of R.O.A.C.H.: pstools rocks, been using it for ages.
If you want the same capability on Windows, you can download and install PSTools, and use the PSShutdown command contained therein.
If you want to remotely shut down a machine, open up a command prompt and type:
If you want to reboot the machine instead, use:
I use PSTools on a daily basis as part of my sysadmin work. It's insanely useful.
HeartBurnKid: Agent of R.O.A.C.H.
Or just use [insecure.org]
TheFu
@Chris Balcum: as far as I know WOL still requires the mobo to be in stand-by mode. I'm not sure how much power this uses, though. I'm sure it's as good of a solution as we'll ever see.
SamburgerHandwich
This should work from a Mac as well. OS X has Samba built in.
waffffffle
@SamburgerHandwich: Robotic arm connected to a microserver could do it.
Um, you can do anything to a Windows machine remotely from *NIX if you just install cygwin on the Windows box. Select the sshd package, then go into the cygwin shell and run:
ssh-host-config
After that, you can login to the Windows box using ssh just like any other *NIX machine.
For extra fun, you can also reconfigure the sshd process to allow it to launch applications remotely, with the following commands in cygwin:
cygrunsrv -E sshd # stop sshd
cygrunsrv -R sshd # remove the sshd service
cygrunsrv -I sshd -i --path=/usr/sbin/sshd # reinstall the sshd service allowing interactive desktop access
cygrunsrv -S sshd # start sshd again
Now you can run any command and launch applications and stuff on the Windows machine via ssh.
Rowin Andruscavage
@Phoshi: Getting into Rube Goldberg territory there.
okidokedork
Here's another handy windows shutdown tip: the power shutdown.
Instead of doing it the normal way, hig windows-r and type shutdown -f -s -t 0. This will shut the computer down FAST, it will bypass all those stupid "waiting for crappo.dll to close" messages. Nothing worse than coming in to work in the morning and see your computer still trying to shut down from the night before.
Then, if you haven't typed anything else in the run window, all you have to do in the future is press "windows-r", then enter. Boom!
Works for XP, don't know about Vista.
zyodei