Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for lastboot.cmd

(view source code of lastboot.cmd as plain text)

  1. /* Show date and time of last boot for a specified server */
  2.  
  3. parse upper arg SrvName dummy
  4. SrvName = strip( SrvName )
  5. if dummy <> '' | SrvName = '' | pos( '?', SrvName ) > 0 | pos( '/', SrvName ) > 0 then call Syntax
  6. if left( SrvName, 2 ) <> '\\' & SrvName <> '*' then SrvName = '\\'||SrvName
  7. if SrvName = '*' then SrvName = ''
  8.  
  9. if RxFuncQuery( 'LoadLsRxutFuncs' ) <> 0 then do
  10. 	call RxFuncAdd 'LoadLsRxutFuncs', 'LSRXUT', 'LoadLsRxutFuncs'
  11. 	call LoadLsRxutFuncs
  12. end
  13.  
  14. NETSTATISTICS        = 195
  15. REQ_STAT             = 0
  16. SRV_STAT             = 1
  17.  
  18. /* The server statistics */
  19. myRc = NetGetInfo(NETSTATISTICS, 'statisticsInfo', SrvName, SRV_STAT, 10)
  20.  
  21. if myRc <> '0' then do
  22. 	say 'Got error from NetGetInfo(NETSTATISTICS) ' myRc
  23. 	exit 9
  24. end
  25.  
  26. if SrvName = '' then SrvName = 'this computer'
  27. say
  28. say 'Last boot of '||SrvName||':      'statisticsInfo.start
  29. exit 0
  30.  
  31.  
  32. Syntax: procedure
  33. 	say
  34. 	say 'LASTBOOT'
  35. 	say
  36. 	say 'Show last boot date and time of specified server'
  37. 	say
  38. 	say 'Usage:'
  39. 	say '  To check (remote) server:      LASTBOOT  \\server_name'
  40. 	say '  To check local requester:      LASTBOOT  *'
  41. 	exit 5
  42. return
  43.  

page last uploaded: 2017-07-06, 12:37