reboot using a batch file?
Windows Server Forum Index Windows Server
Server discussion on Windows platform.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web winserverhelp.com
reboot using a batch file?

 
Post new topic   Reply to topic    Windows Server Forum Index -> Programming
Author Message
ib_redbeard
Guest





Posted: Thu Dec 30, 2004 8:59 pm    Post subject: reboot using a batch file? Reply with quote

I wanted to reboot a bunch of computers on my domain, and thanks to a
previous post, I found the command:
for /f %x in (machines.txt) do shutdown /m \\%x /r /t 0 /f

Its works perfectly when I inmput it directly the command prompt, but when I
have that in a batch file, it doesn't work. It gives me "-t was unexpected
at this time." I'v etried different things but can't get it to work. Any
idea how to get this to work in a batch file as it does when diectly inputted
into the command prompt? Thanks
Back to top
Jeremy
Guest





Posted: Mon Jan 03, 2005 7:55 pm    Post subject: RE: reboot using a batch file? Reply with quote

I use the sysinternals PSShutdown cmd and it works for me. Here is the
contents of my batch:

<batch>
@ECHO OFF
for /F "tokens=* " %%i IN (PCs.txt) DO (
echo.
echo #########################################
echo Rebooting %%i
psshutdown -f -r -t 1 \\%%i -u <UID> -p <password>
sleep 2
)
</batch>

I included sleep in it because I ran into problems if I didn't give it time.

You can also do this in VBScript here:
http://www.robvanderwoude.com/wshexamples_pz.html#R

"ib_redbeard" wrote:

Quote:
I wanted to reboot a bunch of computers on my domain, and thanks to a
previous post, I found the command:
for /f %x in (machines.txt) do shutdown /m \\%x /r /t 0 /f

Its works perfectly when I inmput it directly the command prompt, but when I
have that in a batch file, it doesn't work. It gives me "-t was unexpected
at this time." I'v etried different things but can't get it to work. Any
idea how to get this to work in a batch file as it does when diectly inputted
into the command prompt? Thanks
Back to top
 
Post new topic   Reply to topic    Windows Server Forum Index -> Programming All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




New Topics Powered by phpBB