Solved

Shutdown all computers at once on a network?

Posted on 2004-04-16
7
1,761 Views
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!
0
Comment
Question by:WavyGravy
7 Comments
 
LVL 6

Assisted Solution

by:parkerig
parkerig earned 150 total points
Comment Utility
Hi,
Windows comes with a shutdown.exe ( c:\windows\system32 )
Shutdown /? gives syntax

Below is a link to the code I modified for my system
http://digital-forums.com/showthread.php?p=1431096#post1431096

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.

Cheers
Ian
0
 

Accepted Solution

by:
botplus earned 200 total points
Comment Utility
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

C:\>shutdown
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)
0
 
LVL 22

Assisted Solution

by:kristinaw
kristinaw earned 150 total points
Comment Utility
Wavy,

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.

Kris.
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
LVL 7

Expert Comment

by:jatcan
Comment Utility
I'm interested in the VB code for that purpose--go ahead and post it.

Cheers,

Jatcan
0
 
LVL 6

Expert Comment

by:parkerig
Comment Utility
WavyGravy,
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"

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

Cheers
Ian
0
 
LVL 22

Expert Comment

by:kristinaw
Comment Utility
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
            OpSys.Shutdown()
      Next
      
Next

'Done
wscript.Echo "Done"
WScript.Quit(0)
------------------------------------------------------------------------------------------------------------------
0
 
LVL 1

Author Comment

by:WavyGravy
Comment Utility
Wow guys, this is great!  Thanks for all of the feedback!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Need to remotely monitor systems cpu & memory usage 11 105
Syslinux UEFI USB boot 4 266
PERL - Find newest folder 12 100
AS400  SNDDST Truncating 5 74
I don't know if many of you have made the great mistake of using the Cisco Thin Client model with the management software VXC. If you have then you are probably more then familiar with the incredibly clunky interface, the numerous work arounds, and …
Windows 10 is here and for most admins this means frustration and challenges getting that first working Windows 10 image. As in my previous sysprep articles, I've put together a simple help guide to get you through this process. The aim is to achiev…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now