Link to home
Start Free TrialLog in
Avatar of samiam41
samiam41Flag for United States of America

asked on

Restart network pc's with psshutdown or psexec

Experts!  I have a Windows XP/2003 AD network with 200+ pc's.  I would like to restart them with a script.  I used net view to dump the computers to a text file and tried psshutdown.  If I do the pc's one at a time, it works.  If I try the script, it gives me an error about not being able to access the pc and to make sure the admin share is available.

I would just like to restart the computers in the pc.txt file.  Any suggestions would be appreciated.  Thank you!
Avatar of avilov
avilov
Flag of United States of America image

I am not familiar with pcshutdown but you should be able to use that with minimal change

FOR /F %i in (pc.txt) do shutdown -r -f -m \\%i
Avatar of samiam41

ASKER

Thanks for the post.  It just runs shutdown /r /f over and over and over.....

What did I enter wrong?
ASKER CERTIFIED SOLUTION
Avatar of avilov
avilov
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
it echo'd them all out.  everything looked right.
so if you run the first one it will run shutdown command for all of your servers

avilov.....  I am an idiot.  I named a batch file named shutdown and saved it in the same directory as I was running the shutdown command from.  The result, the "for" command ran my POS batch file and nothing happened.  You did great!  Thanks for the help.  Your command works.  Can I echo the results to a text file?
sure, just use >> result.txt at end of the command, like that

FOR /F %i in (pc.txt) do shutdown -r -f -m \\%i >> result.txt
Awesome!!!  Thanks for the help.  See if you can work you magic on this one.  : )

https://www.experts-exchange.com/questions/23072816/Copy-shortcut-based-on-username.html