#include-once #include "WTS.au3" Opt("MustDeclareVars",1) Func _ServiceExists($pName) Local $lReturn = _Run("sc.exe", "query " & $pName, @SystemDir) If StringInStr($lReturn, "does not exist") Then Return False Else Return True EndIf EndFunc Func _ServiceStart($pName) Local $lReturn = _Run("sc.exe", "start " & $pName, @SystemDir) EndFunc Func _ServiceStatus($pName) Local $lReturn = _Run("sc.exe", "query " & $pName, @SystemDir) If StringInStr($lReturn, "RUNNING") Then Return "RUNNING" ElseIf StringInStr($lReturn, "STOPPED") Then Return "STOPPED" ElseIf StringInStr($lReturn, "PAUSED") Then Return "PAUSED" ElseIf StringInStr($lReturn, "STARTING") Then Return "STARTING" ElseIf StringInStr($lReturn, "STOPPING") Then Return "STOPPING" Else SetError(1,0,False) EndIf EndFunc