?
Solved

Remote Shutdown with batch file for Windows 7

Posted on 2011-09-21
7
Medium Priority
?
1,198 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 79

Accepted Solution

by:
arnold earned 400 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 400 total points
ID: 36576293
shutdown /r /f /m \\S4-01 /t 0

the /t 0 is your problem I think
0
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

 
LVL 25

Assisted Solution

by:Lionel MM
Lionel MM earned 800 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 800 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 400 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

Industry Leaders: 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!

Question has a verified solution.

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

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
The SignAloud Glove is capable of translating American Sign Language signs into text and audio.
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…
Starting up a Project
Suggested Courses

800 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