rigneydolphin
asked on
Batch File to shut down network PC's
Hi,
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?
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"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, il test these today
ASKER
thanks for your suggestions, can't manage to get any of these to work so going to purchase software instead i think. its taking too long to get it sorted :-(
That's true only when you know of software doing this ... Don't underestimate the effort for searching for and testing software!
ASKER
Got a variation of your solution working.
Thanks for your help
Thanks for your help
start /b "" shutdown .... ^& exit /b
instead of start, no additional windows will appear (but the one-and-only console window output is a mess).