Shutdown all computers at once on a network?

Posted on 2004-04-16
Last Modified: 2012-07-28
I'm currently running a domain with Windows 2000 Server edition, and all client computers using XP Professional.  Is there a way to setup a script, or something of that nature, that will allow me to shutdown or restart all of the computers on the network (with the exception of the server) at once?  Thanks in advance!
Question by:WavyGravy
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Assisted Solution

parkerig earned 150 total points
ID: 10844655
Windows comes with a shutdown.exe ( c:\windows\system32 )
Shutdown /? gives syntax

Below is a link to the code I modified for my system

You can modify this and run it as part of user login process.
My script looks nothing like the above as I don't prompt user etc. but its very easy to change and I like to give credit to those whose code I have got my inspiration from.


Accepted Solution

botplus earned 200 total points
ID: 10844737
there is a shutdown.exe under C:\WINDOWS\system32\ in winxp and the switch "-m \\computername" can remote shutdown computer on the network, as i remember there is also a shutdown.exe in win2k but switches are different, or if u want to shutdown all computer without typing all the computer name then there are many third party software can do the job, here is the usage of winxp shutdown.exe

Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "c
omment"] [-d up:xx:yy]

        No args                 Display this message (same as -?)
        -i                      Display GUI interface, must be the first option
        -l                      Log off (cannot be used with -m option)
        -s                      Shutdown the computer
        -r                      Shutdown and restart the computer
        -a                      Abort a system shutdown
        -m \\computername       Remote computer to shutdown/restart/abort
        -t xx                   Set timeout for shutdown to xx seconds
        -c "comment"            Shutdown comment (maximum of 127 characters)
        -f                      Forces running applications to close without warning
        -d [u][p]:xx:yy         The reason code for the shutdown
                                u is the user code
                                p is a planned shutdown code
                                xx is the major reason code (positive integer less than 256)
                                yy is the minor reason code (positive integer less than 65536)
LVL 22

Assisted Solution

kristinaw earned 150 total points
ID: 10844873

I have a vb script that will do this. It's designed to shutdown all computers (servers, whatever) in an entire OU. Let me know if you're interested and I'll post the code for you to try.

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!


Expert Comment

ID: 10845337
I'm interested in the VB code for that purpose--go ahead and post it.



Expert Comment

ID: 10845364
Note that as the shutdown command displays a message for -t xx seconds it is probably better to have the login script add a task to the scheduler using the at command

at 7:30 "c:\windows\system32\Shutdown.exe -s -t 300"

dim wshshell
set wshshell = wscript.createobject("") "at 20:00 c:\windows\system32\Shutdown.exe -s -t 300"

LVL 22

Expert Comment

ID: 10845555
the following code will shut down all the computers in the given OU. enjoy. you can run it right from your desk. just copy and paste into notepad, save as whatever.vbs and you're off. please teset first!

On Error Resume Next

'Define the OU which contains the servers you would like to shut down
Set objOU = GetObject("LDAP://ou=yourou,dc=yourdomain,dc=com")
objOU.Filter = Array("Computer")

For Each objComp In objOU
      strComputer = objComp.Name
      strName = Replace(strComputer, "CN=", "")
      'wscript.Echo strName
      Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//" & strName & "/root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
      'Actual shutdown
      for each OpSys in OpSysSet

wscript.Echo "Done"

Author Comment

ID: 10845667
Wow guys, this is great!  Thanks for all of the feedback!

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
strange occurence with windows 11 155
dsquery command line assistance 2 127
SCCM firewall status and security group members 4 65
Autosar OS Multicore Share Resources confusion ? 2 111
Introduction How to create multiboot configuration with XP\Vista and Windows 7 on it? And most important question - how to do this correctly so not to have any kind of nightmares we get when system gets screwed? First of all one should realize t…
In a recent article here at Experts Exchange (, I discussed my nine-month sandbox testing of the Windows 10 Technical Preview, specifically with respect to r…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question