Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
1.8 KiB

  1. Sub Open( )
  2. End Sub
  3. Function Close( )
  4. End Function
  5. Function Online( )
  6. Dim objWmiProvider
  7. Dim objService
  8. Dim strServiceState
  9. ' Check to see if the service is running
  10. set objWmiProvider = GetObject("winmgmts:/root/cimv2")
  11. set objService = objWmiProvider.get("win32_service='msftpsvc'")
  12. strServiceState = objService.state
  13. If ucase(strServiceState) = "RUNNING" Then
  14. Online = True
  15. Else
  16. ' If the service is not running, try to start it. If it won't start, log an error
  17. response = objService.StartService()
  18. ' response = 0 or 10 indicates that the request to start was accepted
  19. If ( response <> 0 ) and ( response <> 10 ) Then
  20. Resource.LogInformation "The resource failed to come Online because the MSFTPSVC service is not running."
  21. Online = False
  22. Else
  23. Online = True
  24. End If
  25. End If
  26. End Function
  27. Function Offline( )
  28. End Function
  29. Function Terminate( )
  30. End Function
  31. Function LooksAlive( )
  32. Dim objWmiProvider
  33. Dim objService
  34. Dim strServiceState
  35. set objWmiProvider = GetObject("winmgmts:/root/cimv2")
  36. set objService = objWmiProvider.get("win32_service='msftpsvc'")
  37. strServiceState = objService.state
  38. if ucase(strServiceState) = "RUNNING" Then
  39. LooksAlive = True
  40. Else
  41. LooksAlive = False
  42. End If
  43. End Function
  44. Function IsAlive( )
  45. Dim objWmiProvider
  46. Dim objService
  47. Dim strServiceState
  48. set objWmiProvider = GetObject("winmgmts:/root/cimv2")
  49. set objService = objWmiProvider.get("win32_service='msftpsvc'")
  50. strServiceState = objService.state
  51. if ucase(strServiceState) = "RUNNING" Then
  52. IsAlive= True
  53. Else
  54. IsAlive = False
  55. End If
  56. End Function