RemoveService Method

Action2 Example

Windows NT Machines Only

 

Encapsulates the AutoMate™ action in the “Services” group, “Remove a service.” The method attempts to remove the specified service from the Windows NT Service Control Manager (SCM).

 

Declaration

function RemoveService (varServiceName As Variant,

intStopFirst As Integer) As Integer

 

Parameters

varServiceName

 The name of the service (as it appears in the SCM) to be removed.

 

intStopFirst

 Specifies whether or not AutoMate™ should attempt to stop the service before removing it. Set to “1” to attempt to stop the service first or set to “0” to remove the service.

 

Description

The RemoveService method attempts to locate the service varServiceName in the Service Control Manager and remove it.

 

Services should be stopped before attempting to remove them from the SCM. AutoMate™ may, however, take a longer period of time to remove the service if it attempts to stop a service that is already stopped. Therefore, you should set intStopFirst to “1” only if you know the service is running to avoid a performance hit.

 

RemoveService returns “0” if the service was successfully removed; otherwise, it returns “1.” Use the GetLastError property to retrieve the error message generated by a failed removal attempt.

 

The function is applicable only to AutoMate™ installations running on Windows NT and Windows 2000 systems.