Batch Network Shutdown
Posted: 14 Apr 2011 12:07
I am attempting to make a batch file that will shut down every computer on my network. I am fairly new to batch in general but I am eager to learn. Here is what I have, apparently it cannot connect to my network itself and ends up only shutting down the computer I am working on. Is it possible, any help? Thanks.
Here is what I have:
@Echo off
cd\
Echo Netshut=Program
REM ****************************
REM * Program Variables *
REM ****************************
set varcomputer=EP-1-1.mysnowleopard.local
goto loop
:EP-1-1.mysnowleopard.local
set varcomputer=EP-1-2.mysnowleopard.local
goto loop
:EP-1-2.mysnowleopard.local
set varcomputer=EP-1-3.mysnowleopard.local
goto loop
:EP-1-3.mysnowleopard.local
set varcomputer=EP-1-4.mysnowleopard.local
goto loop
:EP-1-4.mysnowleopard.local
set varcomputer=EP-1-5.mysnowleopard.local
goto loop
:EP-1-5.mysnowleopard.local
set varcomputer=EP-1-6.mysnowleopard.local
goto loop
:EP-1-6.mysnowleopard.local
set varcomputer=EP-1-7.mysnowleopard.local
goto loop
:EP-1-7.mysnowleopard.local
set varcomputer=EP-1-8.mysnowleopard.local
goto loop
:EP-1-8.mysnowleopard.local
set varcomputer=EP-1-9.mysnowleopard.local
goto loop
:EP-1-9.mysnowleopard.local
set varcomputer=EP-1-10.mysnowleopard.local
goto loop
:EP-1-10.mysnowleopard.local
set varcomputer=EP-1-11.mysnowleopard.local
goto loop
:EP-1-11.mysnowleopard.local
set varcomputer=EP-1-12.mysnowleopard.local
goto loop
:EP-1-12.mysnowleopard.local
set varcomputer=EP-1-13.mysnowleopard.local
goto loop
:EP-1-13.mysnowleopard.local
set varcomputer=EP-1-14.mysnowleopard.local
goto loop
:EP-1-14.mysnowleopard.local
set varcomputer=EP-1-15.mysnowleopard.local
goto loop
:EP-1-15.mysnowleopard.local
set varcomputer=EP-2-1.mysnowleopard.local
goto loop
:EP-2-1.mysnowleopard.local
set varcomputer=EP-2-2.mysnowleopard.local
goto loop
:EP-2-2.mysnowleopard.local
set varcomputer=EP-2-3.mysnowleopard.local
goto loop
:EP-2-3.mysnowleopard.local
set varcomputer=EP-2-5.mysnowleopard.local
goto loop
:EP-2-5.mysnowleopard.local
set varcomputer=EP-2-6.mysnowleopard.local
goto loop
:EP-2-6.mysnowleopard.local
set varcomputer=EP-2-7.mysnowleopard.local
goto loop
:EP-2-7.mysnowleopard.local
set varcomputer=EP-2-8.mysnowleopard.local
goto loop
:EP-2-8.mysnowleopard.local
set varcomputer=EP-2-9.mysnowleopard.local
goto loop
:EP-2-9.mysnowleopard.local
set varcomputer=EP-2-10.mysnowleopard.local
goto loop
:EP-2-10.mysnowleopard.local
set varcomputer=EP-2-11.mysnowleopard.local
goto loop
:EP-2-11.mysnowleopard.local
set varcomputer=EP-2-12.mysnowleopard.local
goto loop
:EP-2-12.mysnowleopard.local
set varcomputer=EP-2-13.mysnowleopard.local
goto loop
:EP-2-13.mysnowleopard.local
set varcomputer=EP-2-14.mysnowleopard.local
goto loop
:EP-2-14.mysnowleopard.local
set varcomputer=EP-2-15.mysnowleopard.local
goto loop
:EP-2-15.mysnowleopard.local
Exit
REM ****************************
REM * Program *
REM ****************************
:loop
echo Shutting down %varcomputer%
shutdown -s -m \\%varcomputer% -t 30 -c "Your computer will now shut down, I am in complete control. Have a nice day, the end is near. "
goto %varcomputer%
Thanks again.
Here is what I have:
@Echo off
cd\
Echo Netshut=Program
REM ****************************
REM * Program Variables *
REM ****************************
set varcomputer=EP-1-1.mysnowleopard.local
goto loop
:EP-1-1.mysnowleopard.local
set varcomputer=EP-1-2.mysnowleopard.local
goto loop
:EP-1-2.mysnowleopard.local
set varcomputer=EP-1-3.mysnowleopard.local
goto loop
:EP-1-3.mysnowleopard.local
set varcomputer=EP-1-4.mysnowleopard.local
goto loop
:EP-1-4.mysnowleopard.local
set varcomputer=EP-1-5.mysnowleopard.local
goto loop
:EP-1-5.mysnowleopard.local
set varcomputer=EP-1-6.mysnowleopard.local
goto loop
:EP-1-6.mysnowleopard.local
set varcomputer=EP-1-7.mysnowleopard.local
goto loop
:EP-1-7.mysnowleopard.local
set varcomputer=EP-1-8.mysnowleopard.local
goto loop
:EP-1-8.mysnowleopard.local
set varcomputer=EP-1-9.mysnowleopard.local
goto loop
:EP-1-9.mysnowleopard.local
set varcomputer=EP-1-10.mysnowleopard.local
goto loop
:EP-1-10.mysnowleopard.local
set varcomputer=EP-1-11.mysnowleopard.local
goto loop
:EP-1-11.mysnowleopard.local
set varcomputer=EP-1-12.mysnowleopard.local
goto loop
:EP-1-12.mysnowleopard.local
set varcomputer=EP-1-13.mysnowleopard.local
goto loop
:EP-1-13.mysnowleopard.local
set varcomputer=EP-1-14.mysnowleopard.local
goto loop
:EP-1-14.mysnowleopard.local
set varcomputer=EP-1-15.mysnowleopard.local
goto loop
:EP-1-15.mysnowleopard.local
set varcomputer=EP-2-1.mysnowleopard.local
goto loop
:EP-2-1.mysnowleopard.local
set varcomputer=EP-2-2.mysnowleopard.local
goto loop
:EP-2-2.mysnowleopard.local
set varcomputer=EP-2-3.mysnowleopard.local
goto loop
:EP-2-3.mysnowleopard.local
set varcomputer=EP-2-5.mysnowleopard.local
goto loop
:EP-2-5.mysnowleopard.local
set varcomputer=EP-2-6.mysnowleopard.local
goto loop
:EP-2-6.mysnowleopard.local
set varcomputer=EP-2-7.mysnowleopard.local
goto loop
:EP-2-7.mysnowleopard.local
set varcomputer=EP-2-8.mysnowleopard.local
goto loop
:EP-2-8.mysnowleopard.local
set varcomputer=EP-2-9.mysnowleopard.local
goto loop
:EP-2-9.mysnowleopard.local
set varcomputer=EP-2-10.mysnowleopard.local
goto loop
:EP-2-10.mysnowleopard.local
set varcomputer=EP-2-11.mysnowleopard.local
goto loop
:EP-2-11.mysnowleopard.local
set varcomputer=EP-2-12.mysnowleopard.local
goto loop
:EP-2-12.mysnowleopard.local
set varcomputer=EP-2-13.mysnowleopard.local
goto loop
:EP-2-13.mysnowleopard.local
set varcomputer=EP-2-14.mysnowleopard.local
goto loop
:EP-2-14.mysnowleopard.local
set varcomputer=EP-2-15.mysnowleopard.local
goto loop
:EP-2-15.mysnowleopard.local
Exit
REM ****************************
REM * Program *
REM ****************************
:loop
echo Shutting down %varcomputer%
shutdown -s -m \\%varcomputer% -t 30 -c "Your computer will now shut down, I am in complete control. Have a nice day, the end is near. "
goto %varcomputer%
Thanks again.