The Code
There are four separate files you need for running this hack:
Disaster.bat, PassList.bat,
ReadList.bat, and
ServerList.txt. Following is the code for each
of them; instructions on how to customize them for your own
environment are covered in the next section.
Disaster.bat
REM ***********************
REM Author: David Jaffe
REM Runs Disaster Recovery Commands On Servers.
REM Version 1.1
REM Will Break Out NT 4 Servers From Windows 2000 Servers In Next Version
REM ***********************
If "%OS%"=="Windows_NT" goto MAIN
If not"%OS%"=="Windows_NT" goto DOSEXIT
:MAIN
REM This copies ERD files from the target computer to a central repository
net use Q: \\%1\c$
c:\winnt\system32\xcopy.exe q:\winnt\repair\*.* e:\erd\%1\ /q /r /h /y
net use Q: /delete /y
REM Collect Services and Driver details plus more info about the server. Writes the REM
text file to the folder where the script ran from.
winmsd \\%1 /a /f
REM Collects Basic Info about remote target. Writes a text file to the folder where the
script ran from.
srvinfo -ns \\%1 >srvinfo.txt
REM Collects Shares and security settings. Writes a text file to the folder where the
script ran from.
srvcheck \\%1 >shareinfo.txt
REM Collects all event logs and writes text files for each node. Writes the REM text file
to the folder where the script ran from.
dumpel -f eventsys.txt -s \\%1 -l system
dumpel -f eventapp.txt -s \\%1 -l application
dumpel -f eventsec.txt -s \\%1 -l security
REM Copies and deletes all text files found in the folder the script ran from.
REN serverlist.txt serverlist.doc
copy c:\erdscript\*.txt e:\erd\%1\
DEL c:\erdscript\*.txt
:DOSEXIT
echo
echo This Program Requires NT 4 Or 2000 Server To Run
echo
ReadList.bat
REM Reads The ServerList.txt And Passes The Names to Passlist.bat
REN serverlist.doc serverlist.txt
for /F %%A in (c:\erdscript\serverlist.txt) do (call c:\erdscript\passlist.bat %%A)
PassList.bat
REM Runs The Commands Listed In Disaster.bat Incremmentally On Each Machine Listed In
ServerText.txt
c:\erdscript\Disaster.bat %1
ServerList.txt
servernameA
servernameB
servernameC
servernameD
servernameE
and so on.......