Pages

Tuesday, 18 October 2011

Check Service is Running: Check to see if a windows service is running.


' =============================================================
' function: CheckIfServiceIsRunning
' desc : Check to see if a service is running
' params : strServiceName is the name of the service
' returns : True if running, False otherwise
' =============================================================
Function CheckIfServiceIsRunning(strServiceName)

Dim objShell, blnStatus 

' create the shell object
Set objShell= CreateObject("Shell.Application")
blnStatus = objShell.IsServiceRunning(strServiceName) 

' return status of service
CheckIfServiceIsRunning = blnStatus

End Function 'CheckIfServiceIsRunning


0 comments:

Post a Comment