samiam41
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!
I would just like to restart the computers in the pc.txt file. Any suggestions would be appreciated. Thank you!
ASKER
Thanks for the post. It just runs shutdown /r /f over and over and over.....
What did I enter wrong?
What did I enter wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
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
ASKER
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
FOR /F %i in (pc.txt) do shutdown -r -f -m \\%i >> result.txt
ASKER
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
https://www.experts-exchange.com/questions/23072816/Copy-shortcut-based-on-username.html
FOR /F %i in (pc.txt) do shutdown -r -f -m \\%i