3

How can I shutdown/restart all the computers in the domain? When I'm on the domain controller logged in as the admin.

The Clients are Windows 7 and the Server is a Windows Server 2008 machine. I have tried

 shutdown.exe /i

and then selecting the computer but it just comes back with:

PCNAME: The entered computer name is not valid or remote shutdown is not suppor ted on the target computer. Check the name and then try again or contact your system administrator.(53)
3
  • What is your actual goal? If, for example, you want power savings by shutting down machines at night, there are GPOs from EnergyStar that can accomplish this, and more flexibly than a brute-force shutdown that might interrupt someone who is staying late at work.
    – mfinni
    Feb 2, 2010 at 19:34
  • Duplicate of your other question. serverfault.com/questions/108879/…
    – DanBig
    Feb 4, 2010 at 20:47
  • Thank you for merging them thus letting me select an answer
    – Jonathan.
    Feb 4, 2010 at 21:10

4 Answers 4

2

To refresh group policy changes on a computer, there's no need to reboot. Use

GPUPDATE

If you wish to force teh re-application of all group policies (rather than just the changes), you can use

GPUPDATE /force

If you wish to target only per-user or per-machine policies, specify that with

GPUPDATE /Target:Computer
GPUPDATE /Target:User

If you wish to force the next update to be performed synchronously, you can use

GPUPDATE /sync

If you need to apply an policy changes that require a user logoff (eg. folder redirection, application deployment) then you can force a logoff with

GPUPDATE /Logoff

Similarly, for policies such as computer-targeted software installation that are only processed at boot-up, you can cause a reboot with

GPUPDATE /Boot

1
  • Thank you I thought there should be a better way to do this.
    – Jonathan.
    Feb 4, 2010 at 21:08
6

The tool psshutdown from Sysinternals supports wildcards for computer names.

Usage: psshutdown [[\\computer[,computer[,..] | @file [-u user [-p psswd]]] -s|-r|-h|-d|-k|-a|-l|-o [-f] [-c] [-t nn|h:m] [-n s] [-v nn] [-e [u|p]:xx:yy] [-m "message"]

-          Displays the supported options.

computer    Perform the command on the remote computer or computers specified. If 
            you omit the computer name the command runs on the local system, and 
            if you specify a wildcard (\\*), the command runs on all computers in 
            the current domain.

@file       Run the command on each computer listed in the text file specified.

...

Edit: As suggested by emgee in a comment, I added information regarding the use of a file to list the computers to be shut down.

5
  • I've used psshutdown to shutdown groups of machines before but I'm curious about the wildcard - is it smart enough not to shutdown the system you're running from until it's hit all the others? And does it shut itself down then too?
    – Helvick
    Feb 2, 2010 at 19:13
  • Nice one!!!!!!!
    – r0ca
    Feb 2, 2010 at 19:20
  • 5
    Must... resist... urge... to... try...
    – ceejayoz
    Feb 2, 2010 at 19:29
  • 2
    Better than doing this with wildcards is export a list of all the computers to a text file, edit as necessary, then feed psshutdown the text file. I do a reboot remotely like this to install group policy assigned software, but I always exclude the servers for obvious reasons.
    – user17642
    Feb 2, 2010 at 19:41
  • 1
    nice but I prefer to use the built in tools in Windows, this seems to do the exact same thing as shutdown.exe which is included in windows.
    – Jonathan.
    Feb 4, 2010 at 21:09
4

Method 1: Command line

I always like to use inbuilt utilities when they are available. In this case the command is “shutdown”.

If you open up a command prompt (Start > Run > Cmd) and type “shutdown”, you will see that there are a bundle of arguments you can use with the shutdown command. The -m argument followed by the machine name, and a -r(restart trigger) will shutdown your computer. The best way for me to explain it is through examples.

In the command prompt, try the following:

shutdown -m \\computername -s

Lets break it down:

  • 1.The shutdown command gets the ball rolling
  • 2.-m \computername should be the name of the computer you want to shutdown.
  • 3.-s tells the remote computer to Shutdown.
  • There are a number of other arguments you can use.

  • 1.-r tells the remote computer to Restart

  • 2.-l tells the remote computer to logoff
3
  • To be continued? Feb 2, 2010 at 19:06
  • Should be better now. My english is not that good so that's why it looked weird.
    – r0ca
    Feb 2, 2010 at 19:22
  • 1
    Note that on Server 2008 and Windows versions that have UAC, this requires an elevated command prompt (Run As Administrator).
    – Tim Long
    Feb 3, 2010 at 4:34
1

I know this is an old topic, but I wanted to throw in my 2 cents since I had the same question and this topic didn't have exactly what I was looking for (force reboot all AD computers and NOT servers or the DC). There is a way to do this with just a windows command, and here it is:

for /f %n in ('DSQUERY COMPUTER -o rdn -limit 9999 ^| findstr /i /v /c:"server" /c:"%computername%"') do start "" shutdown.exe /m \\%~n /r /f /t 0

if you run this on a DC it will instantly reboot every computer on the Domain while skipping machines with "server" in the computername.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .