Service_Delete
Description
Section titled “Description”Deletes the specified service. If the service is running, the function stops it first.
If the service doesn’t exist, the function writes this to the package log and returns True.
Syntax
Section titled “Syntax”Service_Delete(sServiceName) 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.
Return value
Section titled “Return value”The function returns False if the service can’t be stopped or deleted. giErrorCode contains the return code from Windows. If Windows marks the service for deletion, for example because another program has it open, the function returns True, and Windows removes the service when it’s no longer in use.
Example
Section titled “Example”If bStatus Then bStatus = Service_Delete("Service")Related functions
Section titled “Related functions”Service_Exist Service_Stop Constants Package Property Variables