Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for invshare.bat

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

  1. @ECHO OFF
  2. SETLOCAL
  3. :: Check for valid command line parameter
  4. IF [%1]==[] GOTO Syntax
  5. ECHO.%1 | FIND "?" >NUL
  6. IF NOT ERRORLEVEL 1 GOTO Syntax
  7. :: Remove leading backslashes
  8. FOR /F "tokens=1* delims=\ " %%A IN ('ECHO.%1') DO SET server=%%A
  9. IF NOT DEFINED server GOTO Syntax
  10. :: Check if parameter is a valid server name
  11. NET VIEW \\%server% >NUL 2>NUL
  12. IF ERRORLEVEL 1 GOTO Syntax
  13. :: Read Event Log entries
  14. DUMPEL -e 2511 -l system -m server -s %server%
  15. GOTO End
  16.  
  17.  
  18. :Syntax
  19. ECHO.
  20. ECHO InvalidShares.cmd,  Version 1.00 for Windows NT
  21. ECHO Show log entries concerning invalid shares for specified server
  22. ECHO Written by Rob van der Woude
  23. ECHO.
  24. ECHO Usage:  %~n0  ^<server_name^>
  25. ECHO.
  26. ECHO Uses DUMPEL.EXE from the Microsoft Windows NT 4 Server Resource Kit
  27.  
  28. :End
  29. ENDLOCAL
  30.  

page last uploaded: 2017-04-06, 13:33