Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Remote Shutdown with batch file for Windows 7

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

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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

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…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Simple Linear Regression

618 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