UserControlService method of the Win32_BaseService class

The WMI class method attempts to send a user-defined control code to a service.

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

Syntax

uint32 UserControlService(
  [in] uint8 ControlCode
);

Parameters

ControlCode [in]

Value that specifies a control command to a service. For example a control command is a "pause" or "continue" command. The value can be a predefined code, or a value and action that the service defines. The following are the predefined control codes:

SERVICE_CONTROL_CONTINUE

Notifies a paused service to resume.

SERVICE_CONTROL_INTERROGATE

Notifies a service to report the current status information to the service control manager.

SERVICE_CONTROL_NETBINDADD

Notifies a network service that there is a new component for binding.

SERVICE_CONTROL_NETBINDDISABLE

Notifies a network service that one of its bindings is disabled.

SERVICE_CONTROL_NETBINDENABLE

Notifies a network service that a disabled binding is enabled.

SERVICE_CONTROL_NETBINDREMOVE

Notifies a network service that a component for binding has been removed.

SERVICE_CONTROL_PARAMCHANGE

Notifies a service that its startup parameters are changed.

SERVICE_CONTROL_PAUSE

Notifies a service to pause.

SERVICE_CONTROL_STOP

Notifies a service to stop.

Return value

Returns one of the values listed in the following list, or a different value to indicate an error.

Success

0

The request is accepted.

Not Supported

1

The request is not supported.

Access Denied

2

The user does not have the necessary access rights.

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_BaseService.State property) is equal to 0, 1, or 2.

Service Not Active

6

The service has not started.

Service Request Timeout

7

The service does not respond to the start request quickly.

Unknown Failure

8

Interactive process.

Path Not Found

9

The directory path to the service executable file is 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 that this service relies on is removed from the system.

Service Dependency Failure

13

The service does not find the service needed from a dependent service.

Service Disabled

14

The service is 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

The 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 passed to the service.

Status Invalid Service Account

22

The account that this service runs under is not valid or does not have 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
MOF
CIMWin32.mof
DLL
CIMWin32.dll

See also

Operating System Classes

Win32_BaseService