InstallService Method

Action2 Example

Windows NT Machines Only

 

Encapsulates the AutoMate™ action in the “Services” group, “Install a service.” The method attempts to install a service application into the Service Control Manager (SCM).

 

Declaration

function InstallService (varExecutable As Variant,

varDisplayName As Variant,

varUsername As Variant,

varPassword As Variant,

intErrorType As Integer,

intServiceType As Integer,

intRunType As Integer,

intInteractive As Integer) As Integer

 

Parameters

varExecutable

 The full path, including any command line parameters, to the service executable associated with this service entry.

 

varDisplayName

 The name of the service as it is to appear in the SCM.

 

varUsername

 If the service is to be run in the context of a specific user, supply the Username here.

 

varPassword

 If the service is to be run in the context of a specific user, supply the password to varUsername here.

 

intErrorType

 Specified the type of error control to associate with this service:

  

Value

Meaning

0

Ignore Error

1

Normal Error

2

Critical Error

3

Severe Error

 

intServiceType

 The type of service to install:

  

Value

Meaning

0

Runs in own process

1

Shared process

2

Kernel driver

3

File system driver

 

intRunType

 The run type of the service:

  

Value

Meaning

0

Automatic

1

Manual

2

Disabled

3

Boot

4

System

 

intInteractive

 Specifies whether or not the service should be run as interactive. If it is an interactive process, set intInteractive to “1”; otherwise, set to “0.” Note that if the process is interactive, the varUsername and varPassword variables are ignored.

 

Description

The InstallService method attempts to install a service application into the SCM in one simple to use step.

 

The use of services and the Service Control Manager, however, are beyond the scope of this help file. Please consult the Microsoft Win32 SDK under “Services” for more complete information about services and their use in the Windows NT platform.

 

The method returns “0” if the service was installed successfully; otherwise, it returns “1.” Use the GetLastError property to retrieve the error message generated by a failed start attempt.