Service_SetStartMode
Description
Section titled “Description”Sets the start mode for the specified service.
Valid StartModes are:
- Boot: Device driver started by the operating system loader.
- System: Device driver started by the *IoInitSystem method. This value is valid only for driver services.
- Automatic: Service to be started automatically by the service control manager during system startup.
- AutomaticDelayed: Service to be started automatically and delayed by the service control manager during system startup.
- Manual: Service to be started by the service control manager when a process calls the *StartService method.
- Disabled: Service that can no longer be started.
Syntax
Section titled “Syntax”Service_SetStartMode(sServiceName, sStartMode) As Boolean
Parameters
Section titled “Parameters”sServiceName (String)
Section titled “sServiceName (String)”Name of the service. Use the service name, for example Spooler, not the display name.
sStartMode (String)
Section titled “sStartMode (String)”Start mode. Use one of the Service Start Mode constants, for example SSM_Automatic or SSM_Disabled.
Return value
Section titled “Return value”The function returns False if the service doesn’t exist, or if Windows can’t change the start mode. giErrorCode contains the return code from Windows.
Example
Section titled “Example”If bStatus Then bStatus = Service_SetStartMode("Service", SSM_Disabled)Related functions
Section titled “Related functions”Service_Create Service_Exist Service_Start Constants Package Property Variables