Solved

Remote Shutdown with batch file for Windows 7

Posted on 2011-09-21
7
1,195 Views
Last Modified: 2012-05-12
I used to have a few batch files that I could execute that would use PSshutdown to reboot or shut down a load of computers. It worked flawlessly and was simple. Basically, a .bat file with a series of these commands:

psshutdown \\computername -r -f -n 30

It did the trick. However it does not work in Windows 7. I would like an equally simple way of doing this for windows 7 if possible, to be run from a batch or vbscript? I tried using the shutdown command in the same way...I created a .bat script with these entries:

shutdown -r -f -m \\S4-01
shutdown -r -f -m \\S4-02
shutdown -r -f -m \\S4-03
etc...

But it won't work. It says that either the name is not valid or remote shutdown is not supported (Error 53).
Thanks
0
Comment
Question by:Jason210
[X]
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
7 Comments
 
LVL 11

Author Comment

by:Jason210
ID: 36576147
I just tried to connect to the target computers via RDP and I can't. I think are either off, or in some kind of hibernation mode and I can't wake them up. I think this might be the problem.

In the meantime, is that ^^ batch script ok?
0
 
LVL 78

Accepted Solution

by:
arnold earned 100 total points
ID: 36576258
that is a valid option for shutdown.

if the system is no up and accessible, those directives will not be received.  You may have to configure those systems for the magic packet as a wakeup, and you would need  to maintain the MAC addresses since this is the destination for the magic packet (WOL).

Configure the systems not to hibernate/sleep and disconnect/shutdown the network interface.
0
 
LVL 6

Assisted Solution

by:tmwsiy
tmwsiy earned 100 total points
ID: 36576293
shutdown /r /f /m \\S4-01 /t 0

the /t 0 is your problem I think
0
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!

 
LVL 25

Assisted Solution

by:Lionel MM
Lionel MM earned 200 total points
ID: 36580040
Those are valid commands, even in Windows 7
shutdown -r -f -m \\S4-01
if you don't put a time (-t) it defaults to 60 seconds (1 minute)
So it is more than likely an issue of permissions and/or rights
What error do you get when you run this command and how are you running the commands?
0
 
LVL 11

Author Comment

by:Jason210
ID: 36582978
I ran the commands both as batch scripts and also from command line on the Domain controller. I didn't get a persmissions error. I think the problem is the target computers are in hibernation and not responding, because after I tried to reboot them I tried other ways of communication such as RDP service and that didn't respond either.
0
 
LVL 25

Assisted Solution

by:Lionel MM
Lionel MM earned 200 total points
ID: 36583810
If the PCs are in hibernation then the commands will not work until you get them running again. To that end this link may help you to get the PCs out of hibernation:
http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/Windows/Windows_7/Q_26699517.html?sfQueryTermInfo=1+10+30+7+from+hibern+pc+wake+window

Obviously you can change the PC setting for them not to go into hibernation.
Control Panel\All Control Panel Items\Power Options
0
 
LVL 66

Assisted Solution

by:johnb6767
johnb6767 earned 100 total points
ID: 36584691
Try this on a single machine.....

REM the "-i X" specifies Session # at the console.

psexec \\computername -i 1 shutdown -f -r -n 30

This very well could be a Session 0 isolation issue. More conversation on this here....

psshutdown - No message displayed
http://forum.sysinternals.com/psshutdown-no-message-displayed_topic21119.html
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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
print bytes of an integer 6 47
Copy Sheet to New Workbook based on Cell Value 6 55
junit initializtion error 2 18
Cannot locate cell 15 39
This is about my first experience with programming Arduino.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

737 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