Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for chknav.bat

(view source code of chknav.bat as plain text)

  1. @ECHO OFF
  2. :: Windows NT or 2000 only
  3. VER | FIND "Windows NT" >NUL
  4. IF NOT ERRORLEVEL 1 GOTO ChkCLPar
  5. VER | FIND "Windows 2000" >NUL
  6. IF ERRORLEVEL 1 GOTO Syntax
  7.  
  8. :ChkCLPar
  9. :: No command line parameters necessary
  10. IF NOT "%1"=="" GOTO Syntax
  11.  
  12. :: Check for new servers.
  13. :: Adjust to FIND filter to your own situation;
  14. :: the one used below assumes all workstations
  15. :: have a computer name starting with "PC"
  16. FOR /F "skip=3 eol=T tokens=1* delims=\ " %%A IN ('NET VIEW ^| FIND /V "\\PC"') DO CALL :AddServer %%A
  17.  
  18. :: Check all servers from server list
  19. :: and list all Event Log entries about
  20. :: viruses found by Norton Antivirus
  21. 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)
  22.  
  23. :: Done
  24. GOTO End
  25.  
  26. :AddServer
  27. :: Check if the server list exists and if
  28. :: server is in the list, add server if not
  29. IF EXIST servers.lst (
  30. 	TYPE servers.lst | FIND /I "%1" >NUL
  31. 	IF NOT ERRORLEVEL 1 GOTO:EOF
  32. )
  33. (ECHO.%1)>>servers.lst
  34. GOTO:EOF
  35.  
  36. :Syntax
  37. ECHO.
  38. ECHO ChkNAV.bat,  Version 2.01 for Windows NT
  39. ECHO Log all Norton Antivirus virus alerts from all servers' Event Logs.
  40. ECHO.
  41. ECHO The batch file will use a file named servers.lst in the current
  42. ECHO directory, containing a list of all servers, one server per line,
  43. ECHO no whitespace allowed.
  44. ECHO The file will be created if it does not exist (make sure you have
  45. ECHO write access).
  46. ECHO.
  47. ECHO The virus alerts will be logged (appended) to a tab delimited file
  48. ECHO named %~n0.log located in the current directory (make sure you
  49. ECHO have write access).
  50. ECHO.
  51. ECHO This batch file uses DUMPEL from the Windows NT 4 Server Resource Kit.
  52. ECHO.
  53. ECHO You may need to modify the batch file's FIND filter to make sure only
  54. ECHO servers are checked, and normal workstations aren't.
  55. ECHO.
  56. ECHO Written by Rob van der Woude
  57. ECHO http://www.robvanderwoude.com
  58.  
  59. :End
  60.  

page last modified: 2024-04-16; loaded in 0.0188 seconds