Solved: Shutdown DOS batch script

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

jp1203

Thread Starter
Joined
Jul 20, 2005
Messages
3,427
I have absolutely no idea where to put this, so I just picked a place. If anyone thinks there's a better spot for it, have it moved there please :D

My intentions: to make a DOS batch script that will shut down four machines, then to set it as a scheduled task running at, say, 1 AM

The Problem:
I type something in DOS:

shutdown -s -m \\computername -c "This machine will shut down in two minutes To cancel click the abort shutdown icon on your desktop" -t 120 -f

It works, the remote machine displays a warning and a countdown timer. I have an icon on their desktop that is a batch script with contents:

shutdown -a

to abort the shutdown if someone is on the machine at 1 AM.


If I copy the same script (the shut down one) into notepad save and run the batch file, it goes into this endless loop and does nothing. Anyone know why?

I've attached a screenshot of the running batch script in its endless loop"
 

Attachments

Joined
May 29, 2007
Messages
842
Can you put the contents of your batch script in CODE tags please? Maybe i can help you out. (y)
 

jp1203

Thread Starter
Joined
Jul 20, 2005
Messages
3,427
Changed it slightly with some echo tags, that's all. Still obviously no go.

Code:
@echo off
echo Starting Shutdown Process...
echo Shutting Down Stergis2
shutdown -s -m \\computername -c "This machine will shut down in two minutes To cancel click the abort shutdown icon on your desktop" -t 120 -f
echo Script Complete.
 

Attachments

Joined
May 29, 2007
Messages
842
Ok let me ask this- Are you sure shutdown.exe is on your PC? and the remote pc? cos iytmay need it, and there might be a setting on the remote computer that allows it to be shut down remotely.
 

jp1203

Thread Starter
Joined
Jul 20, 2005
Messages
3,427
I imagine so, because if I just open cmd and type this it works fine and the other machine shows a message for two minutes and shuts down. It's just the script that won't work for some weird reason:

shutdown -s -m \\computername -c "This machine will shut down in two minutes To cancel click the abort shutdown icon on your desktop" -t 120 -f
 
Joined
May 29, 2007
Messages
842
:3 I have a neato idea. but first lemme ask you. would you be willing to use something other than shutdown.exe to shutdown other pc's?
 
Joined
May 29, 2007
Messages
842
two things.

PsShutdown from Sysinternals - Now owned by microsoft..

http://www.microsoft.com/technet/sysinternals/Utilities/PsShutdown.mspx

doesnt require anything installed on the client.

but if you're a little adventurous, check this out.

http://users.pandora.be/jbosman/applications.html

you dont 'need' to install it on the remote pc, but if you dont you cant do any of the fancy things like standby and hibernate..or turning a monitor off.. xD
but pwroff can do things by a scheduling them, and things can be done by command line, as well as remotely by command line. i wouldnt recommend it if you're looking for an easy solution, but its a fun program.
 

jp1203

Thread Starter
Joined
Jul 20, 2005
Messages
3,427
Cool, I'll have to try that Poweroff thing. I like to play :D

Thanks Very Much
 
Joined
May 29, 2007
Messages
842
you ought to check out the sysinternals suite in my sig. very useful tools in der. :)
But dont get carried away, you can fry your PC with some of that stuff.
but yea, tell me how poweroff goes, i love that thing xD
 

jp1203

Thread Starter
Joined
Jul 20, 2005
Messages
3,427
I use newsid from Sysinternals for mass imaging stuff so the SID and puter name are different for every box. Haven't really played with the rest of the stuff too much, I'll have to do that when I have some time to kill. I had a guy working with me who decided that NewSID locked up (it just hit a massive file to change) and rebooted the machine manually. Had to reimage it again.

I scheduled poweroff to shut down a box at 1 AM with a 120 second warning, and started it as a service so we'll see what happens. I'll let you know.

Thanks again
 

jp1203

Thread Starter
Joined
Jul 20, 2005
Messages
3,427
I like the looks of diskmon, as I run this box as a small server. I'll have to play with that.
 
Joined
May 29, 2007
Messages
842
When you make a scheduled task in pwroff, dont forget to 'Save Setting To Service'. (y)
And diskmon is for monitoring when your hard drive is read/written to. i find regmon more useful than that >_>'
 

jp1203

Thread Starter
Joined
Jul 20, 2005
Messages
3,427
Apparently the service ran, when I unlocked this this morning I had a poweroff message that the client accepted the task and that machine is off.

Thanks
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Staff online

Top