JakeBentz

psuptimelist.cmd

Aug 17th, 2013
198
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. :: /=======================================================================
  3. :: /=
  4. :: /=   psuptimelist.cmd
  5. :: /=
  6. :: /=   AUTHOR: Jake Bentz
  7. :: /=   DATE:   10/07/2007
  8. :: /=
  9. :: /=  REVISION HISTORY
  10. :: /=   VER  DATE        AUTHOR/EDITOR   COMMENT
  11. :: /=   1.0  10/07/2007  Jake Bentz      Created script
  12. :: /=   1.1  07/31/2013  Jake Bentz      Rewritten for psinfo
  13. :: /=======================================================================
  14. setlocal
  15. set SYNTAX=Syntax: psuptimelist.cmd [ServerList]
  16.  
  17. :: -- Check for arguments
  18. :: -- If your script has a simple syntax this is an easy way to present
  19. :: -- help text.
  20. if (%1) EQU (/?) echo %SYNTAX% & goto END
  21. if /i (%1) EQU (/h) echo %SYNTAX% & goto END
  22. if (%1) EQU (?) echo %SYNTAX% & goto END
  23. if (%1) EQU (-?) echo %SYNTAX% & goto END
  24. if /i (%1) EQU (-h) echo %SYNTAX% & goto END
  25.  
  26. :SetServerlist
  27. if (%1) EQU () echo ERROR: Missing Server List! & echo %SYNTAX% & goto END
  28. set ServerList=%1
  29. call :SetLogfile
  30. goto :MAIN
  31.  
  32. :MAIN
  33. echo Logging to file: %LogFile%
  34. echo ==============================================================================>%LogFile%
  35. echo         Server Uptime List %date% %time%>>%LogFile%
  36. echo ==============================================================================>>%LogFile%
  37. echo.>>%LogFile%
  38. echo ==================================================>>%LogFile%
  39. echo Getting Uptime for each server . . .
  40.  
  41. for /f %%a in (%serverlist%) do (
  42.     echo ============================================== >> %logfile%
  43.     echo %%a >> %logfile%
  44.     psinfo \\%%a | find "Uptime:" >> %logfile%
  45.     echo ============================================== >> %logfile%
  46.     )
  47. echo Complete!
  48. goto END
  49.  
  50. :SetLogfile
  51. for /F "tokens=1-4 delims=/- " %%A in ('date/T') do set DATE=%%B-%%C-%%D
  52. for /F "tokens=1-4 delims=:., " %%a in ('time/T') do set TIME=%%a%%b%%c
  53. set logfile=psuptime_output_%date%_%time%.txt
  54.  
  55. :END
  56. endlocal
Advertisement
Comments
  • User was banned
Add Comment
Please, Sign In to add comment