Question : Server Reboot Schedule

I am trying to develop a server reboot schedule.
I would like to use the shutdown.exe to possibly call server names listed in a text file to be rebooted all at once.
I could just add and remove of make multiple files for each set of servers (example SQL, exchange, domain controllers each having a separate file)
I would assume a simple batch file could be created to call this file but i do not know how to write it.

Answer : Server Reboot Schedule

Bye
Gastone Canali
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
:: -- This script require "Computers.txt" file on C: drive root 
:: -- from where it will pick computer names.
:: -- shutdown all servers/pcs in the test file if 
:: -- they respond to a ping request
:: --
:: -- Copy and Paste following script into notepad and save
:: -- it with any name having .cmd extension.
:: Batch Script Start
 
@Echo Off
SETLOCAL  
IF NOT EXIST C:\Computers.txt Goto ShowErr
FOR %%F IN (c:\Computers.txt) Do IF %%~zF EQU 0 Goto ShowErry
FOR /F "delims=#" %%c IN ('Type C:\Computers.txt') Do call :SHUT %%c
Goto EndScript
:SHUT
     echo processing %1
     PING -n 2 -w 400 %1|Find /I "TTL" >NUL || echo %1 is switched off
     REM reboot
     IF %errorlevel% EQU 0 shutdown -r -f -m \\%1 -t 10
Goto :EOF
 
:ShowErr
Echo "C:\Computers.txt" file does not exist or file is empty!
:EndScript
ENDLOCAL
:EOF
Open in New Window Select All
Random Solutions  
 
programming4us programming4us