How To Remotely Shut Down Windows XP Computers From A Linux Server

Want to support HowtoForge? Become a subscriber!
 
Submitted by BeauSanders (Contact Author) (Forums) on Thu, 2009-07-02 13:00. :: Linux

How To Remotely Shut Down Windows XP Computers From A Linux Server

As a budget cutback, our school administrators asked us to shutdown all non-essential classroom computers at night to save electricity. I teach Linux in a classroom that has a Dell Poweredge 2850 Red Hat Enterprise Linux (RHEL5) server and 29 Dell Optiplex 745 student lab computers running Microsoft Windows XP SP3 as the host operating system and VMWare Server to provide virtual Linux machines for our classes. I researched on the Internet for the best solution to remotely shutdown the student lab computers at night. I was not able to find one post or how-to that completely answered my questions, but I was able to piece together a solution. In an effort to document this project and help others with similar needs, here are my notes on the project:

 

REQUIREMENTS FOR WINDOWS XP TO BE REMOTELY SHUTDOWN BY A LINUX SERVER:

  1. Disable Simple File Sharing. UNCHECK "Use simple file sharing" under My Computer > Tools > Folder Options > View.
  2. Check the Windows Firewall and make sure ICMP is enabled and File and Printer Sharing is enabled. Go to Control Panel > Security Center > Windows Firewall > Exceptions > CHECK "File and Printer Sharing". Also on the Advanced tab > ICMP Settings > CHECK "Allow incoming echo request".
  3. You must be able to successfully ping the IP address of the remote Windows XP computer you want to shutdown.
  4. The default Local Policy in Windows XP to force a remote shutdown is limited to members of the Administrator group. If you want to change this, use the Group Policy Editor (gpedit.msc) to change this Local Policy. Select Computer Configuration > Windows Settings > Security > Local Policies > User Rights Assignment > Force shutdown for a remote system and change the properties to include the user or group you want to have this authority.

 

REQUIREMENTS FOR THE LINUX SERVER TO REMOTELY SHUTDOWN WINDOWS XP COMPUTERS:

  1. Samba must be installed and working properly. In our subnet, the RHEL5 Samba Server is configured as a WINS server for our own separate workgroup.
  2. It is recommended that the DHCP server be setup to assign static IP addresses to the Windows XP computers. This makes control of the lab computers much easier.
  3. It is also recommended that BIND be setup with a zone file for the subnet to provide DNS resolution for the computers in the lab subnet.
  4. The following command will remotely shutdown a Windows XP computer under this scenario:

    net rpc SHUTDOWN -C "enter a comment to display at shutdown" -f -I x.x.x.x -U username%password

    In this example x.x.x.x is the IP address of the remote Windows XP computer, username is a member of the Administrator group on the Windows XP machine, and password is the correct password associated with the username.
  5. Test your configuration. Samba is very good about letting you know if your command works correctly or if you have problems.
  6. Next create a script to shutdown the Windows XP machines. Use crontab to schedule when you want the remote machines shutdown.

 

OTHER POSTS ON THIS PROCEDURE:

http://www.linuxforums.org/forum/redhat-fedora-linux-help/60324-remote-shutdown-windows-linux-box.html

http://www.lgr.ca/blog/2008/04/shutdown-windows-from-linux.html

http://landofthefreeish.com/linux/howto-remote-shutdown-of-a-windows-computer-from-linux/

http://blog.beausanders.com/?q=node/8


Please do not use the comment function to ask for help! If you need help, please use our forum.
Comments will be published after administrator approval.
Submitted by mfaridi (registered user) on Sun, 2009-07-19 17:14.

It is good command but when I run this command it take 20 second . I want shutdown system in 1 second 

what I must do ?

Submitted by Anonymous (not registered) on Sun, 2009-07-05 01:02.

it's a very good idea to use rpc command... but i would like to comment about firewall disabling ...and most of us know that MS xp has major security issues so i would suggest enabling only rpc port using the firewall settings ....

 

thanx .. ur method shows how felxible and easy things can be with a linux machine

Submitted by derchris (registered user) on Thu, 2009-07-02 13:56.

I use a different approach.

Install cygwin on the Windows machine, together with an ssh server.
Then you can use ssh to shutdown the systems.
Or rsh, rlogin, whatever you prefer.

Cheers,

Christian

Submitted by Naz (not registered) on Fri, 2009-07-03 22:12.

What about "shutdown -s -t 00 \\%computername%"

or

 "shutdown -s -t 00 \\*"

I've never used the latter command, though, so my syntax may be off.

 

 

Submitted by R (not registered) on Sat, 2009-07-04 19:39.
This is not a remote shutdown. But you may be able to install remotely an app to shutdown computers after certain hour.