StopService Method

Sends a service stop control request to the specified Windows NT service and queries the service status to ensure the service has stopped. This method will time out after two minutes.

Syntax

obj.StopService(ServiceName String, [ComputerName String])
Where obj is an OpScrUtil.SCManager object.

Parameters

ServiceName Specifies the name of the service to stop.
ComputerName Specifies the target computer. This parameter is optional. If not specified or an empty string, the local computer is the target.

Return Type

Boolean.

Example

To stop the messenger service on the local computer, enter:

Set obj = CreateObject("OpScrUtil.SCManager")
bOK = obj.StopService("Messenger", "")

Related Topics