1. Home
  2. Docs
  3. Scense Embedded Scripting...
  4. Scense Native Scriptable ...
  5. Service

Service

The service object can be used to stop or start a windows service.
Typically, a user needs administrative privileges to control services.

Properties Description
Returncode

 

Holds the return code fot the StartProcess function

 

Methods Description
StartService

 

 

Start the specified service.
The function accepts a ‘service name’ and returns a Boolean value (True if successful)

Function StartService(ServiceName As String)
StopService

 

 

Stop the specified service.
The function accepts a ‘service name’ and returns a Boolean value (True if successful).

Function StopService(ServiceName As String)

The service name should always be an ‘internal’ service name. (not the display name).

Usage:

Sub Scense_Main()
    With Service
        'Start the Print Spooler service
        If Not .StartService("Spooler") Then
            WriteScenseLog .ReturnCode
        End If
    End With
End Sub