(view source code of chknav.bat as plain text)
@ECHO OFF
:: Windows NT or 2000 only
VER | FIND "Windows NT" >NUL
IF NOT ERRORLEVEL 1 GOTO ChkCLPar
VER | FIND "Windows 2000" >NUL
IF ERRORLEVEL 1 GOTO Syntax
:ChkCLPar
:: No command line parameters necessary
IF NOT "%1"=="" GOTO Syntax
:: Check for new servers.
:: Adjust to FIND filter to your own situation;
:: the one used below assumes all workstations
:: have a computer name starting with "PC"
FOR /F "skip=3 eol=T tokens=1* delims=\ " %%A IN ('NET VIEW ^| FIND /V "\\PC"') DO CALL :AddServer %%A
:: Check all servers from server list
:: and list all Event Log entries about
:: viruses found by Norton Antivirus
FOR /F "tokens=* delims=\" %%A IN ('TYPE servers.lst ^| SORT') DO (DUMPEL -s \\%%A -l Application -e 5 -m "Norton Antivirus" -t >> %~n0.log 2>NUL)
:: Done
GOTO End
:AddServer
:: Check if the server list exists and if
:: server is in the list, add server if not
IF EXIST servers.lst (
TYPE servers.lst | FIND /I "%1" >NUL
IF NOT ERRORLEVEL 1 GOTO:EOF
)
(ECHO.%1)>>servers.lst
GOTO:EOF
:Syntax
ECHO.
ECHO ChkNAV.bat, Version 2.01 for Windows NT
ECHO Log all Norton Antivirus virus alerts from all servers' Event Logs.
ECHO.
ECHO The batch file will use a file named servers.lst in the current
ECHO directory, containing a list of all servers, one server per line,
ECHO no whitespace allowed.
ECHO The file will be created if it does not exist (make sure you have
ECHO write access).
ECHO.
ECHO The virus alerts will be logged (appended) to a tab delimited file
ECHO named %~n0.log located in the current directory (make sure you
ECHO have write access).
ECHO.
ECHO This batch file uses DUMPEL from the Windows NT 4 Server Resource Kit.
ECHO.
ECHO You may need to modify the batch file's FIND filter to make sure only
ECHO servers are checked, and normal workstations aren't.
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
:End
page last modified: 2024-04-16; loaded in 0.0087 seconds