Skip to content

Service_Delete

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.

Service_Delete(sServiceName) As Boolean

Name of the service. Use the service name, for example Spooler, not the display name.

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.

If bStatus Then bStatus = Service_Delete("Service")

Scripting Guidelines

Service_Exist Service_Stop Constants Package Property Variables