I'm trying to create a batch file to shutdown all out network PC's after 12.30 am every night. I created a simple batch file which parses an IP address from a text file then sends a remote shutdown command to that IP address.
This works fine but if the command comes to an IP address of a PC that is already switched off it ties up the batch file for an exorbitant amount of time. (Code below)
I would prefer to add some method to check if the PC is on first then issue the remote shutdown command if PING returns a response.
Any body have any ideas on this?
FOR /F %%i IN (computers.txt) DO shutdown -m \\%%i -f -s -t 300 -c "Remote PC Shutdown in progress"