StopService method of the Win32_BaseService class

The StopService WMI class method stops the service represented by the object derived from Win32_BaseService.

This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see Calling a Method.

Syntax

uint32 StopService();

Parameters

This method has no parameters.

Return value

Returns one of the values listed in the following list or any other value to indicate an error.

Success

0

The request was accepted.

Not Supported

1

The request is not supported.

Access Denied

2

The user did not have the necessary access.

Dependent Services Running

3

The service cannot be stopped because other services that are running are dependent on it.

Invalid Service Control

4

The requested control code is not valid, or it is unacceptable to the service.

Service Cannot Accept Control

5

The requested control code cannot be sent to the service because the state of the service (Win32_BaseServiceState property) is equal to 0, 1, or 2.

Service Not Active

6

The service has not been started.

Service Request Timeout

7

The service did not respond to the start request in a timely fashion.

Unknown Failure

8

Interactive process.

Path Not Found

9

The directory path to the service executable file was not found.

Service Already Running

10

The service is already running.

Service Database Locked

11

The database to add a new service is locked.

Service Dependency Deleted

12

A dependency on which this service relies has been removed from the system.

Service Dependency Failure

13

The service failed to find the service required from a dependent service.

Service Disabled

14

The service has been disabled from the system.

Service Logon Failed

15

The service does not have the correct authentication to run on the system.

Service Marked For Deletion

16

This service is being removed from the system.

Service No Thread

17

There is no execution thread for the service.

Status Circular Dependency

18

There are circular dependencies when starting the service.

Status Duplicate Name

19

There is a service running under the same name.

Status Invalid Name

20

There are invalid characters in the name of the service.

Status Invalid Parameter

21

Invalid parameters have been passed to the service.

Status Invalid Service Account

22

The account which this service is to run under is either invalid or lacks the permissions to run the service.

Status Service Exists

23

The service exists in the database of services available from the system.

Service Already Paused

24

The service is currently paused in the system.

Other

25 4294967295

Requirements

Requirement Value
Minimum supported client
Windows Vista
Minimum supported server
Windows Server 2008
Namespace
Root\CIMV2
Header
Sdoias.h
MOF
CIMWin32.mof
DLL
CIMWin32.dll

See also

Operating System Classes

Win32_BaseService