Main example
List instances
# Abstract class: Get-CimInstance returns the instances of its subclasses
Get-CimInstance -ClassName Win32_BaseService |
Select-Object -Property Name, Description, Status, State, StartMode, StartName, PathNameAbstract class: it has no instances of its own. Get-CimInstance returns the instances of its subclasses (Win32_Service, Win32_SystemDriver).
Examples
Query a remote computer (CIM session)
review before running# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
Get-CimInstance -CimSession $cimSession -ClassName Win32_BaseService |
Select-Object -Property @(
'Name'
'Description'
'Status'
'State'
'StartMode'
'StartName'
'PathName'
)
} finally {
Remove-CimSession -CimSession $cimSession
}WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.
Show the class structure
# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName Win32_BaseService
$cimClass.CimClassProperties |
Select-Object -Property Name, CimType, Flags
# Methods of the class
$cimClass.CimClassMethods |
Select-Object -Property Name, ReturnTypeProperties
| Name | Type | Access | Description | |||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AcceptPause# | boolean | read | Service can be paused. Code | |||||||||||||||||||||||||||||||||||||||
| AcceptStop# | boolean | read | Service can be stopped. Code | |||||||||||||||||||||||||||||||||||||||
| Caption# | string | read | Short description of the object. Code | |||||||||||||||||||||||||||||||||||||||
| CreationClassName# key | string | read | Name of the first concrete class to appear in the inheritance chain used in the creation of an instance. When used with the other key properties of the class, the property allows all instances of this class and its subclasses to be uniquely identified. Code | |||||||||||||||||||||||||||||||||||||||
| Description# | string | read | Description of the object. Code | |||||||||||||||||||||||||||||||||||||||
| DesktopInteract# | boolean | read | Service can create or communicate with windows on the desktop. Code | |||||||||||||||||||||||||||||||||||||||
| DisplayName# | string | read | Display name of the service. This string has a maximum length of 256 characters. The name is case-preserved in the Service Control Manager. Comparisons of DisplayName are always case-insensitive. Constraints: Accepts the same value as the Name property. Example: "Atdisk" Code | |||||||||||||||||||||||||||||||||||||||
| ErrorControl# | string | read | Severity of the error. Service fails to start. The value indicates the action taken by the startup program if failure occurs. All errors are logged by the computer system. Values (5)
Code | |||||||||||||||||||||||||||||||||||||||
| ExitCode# | uint32 | read | Defining any problems encountered in starting or stopping the service. This property is set to ERROR_SERVICE_SPECIFIC_ERROR (1066) when the error is unique to the service represented by this class, and information about the error is available in the ServiceSpecificExitCode property. The service sets this value to NO_ERROR when running, and again upon normal termination. Code | |||||||||||||||||||||||||||||||||||||||
| InstallDate# | datetime | read | Object was installed. This property does not need a value to indicate that the object is installed. Code | |||||||||||||||||||||||||||||||||||||||
| Name# key | string | read | Unique identifier of the service, which provides an indication of the functionality that is managed. This functionality is described in more detail in the object's Description property. Code | |||||||||||||||||||||||||||||||||||||||
| PathName# | string | read | Fully qualified path to the service binary file that implements the service. Example: "\SystemRoot\System32\drivers\afd.sys" Code | |||||||||||||||||||||||||||||||||||||||
| ServiceSpecificExitCode# | uint32 | read | Service-specific error code for errors that occur while the service is either starting or stopping. The exit codes are defined by the service represented by this class. This value is only set when the ExitCodeproperty value is ERROR_SERVICE_SPECIFIC_ERROR (1066). Code | |||||||||||||||||||||||||||||||||||||||
| ServiceType# | string | read | Service provided to calling processes. Values (7)
Code | |||||||||||||||||||||||||||||||||||||||
| Started# | boolean | read | Service has been started. Code | |||||||||||||||||||||||||||||||||||||||
| StartMode# | string | read | Start mode of the Windows base service. Values (5)
Code | |||||||||||||||||||||||||||||||||||||||
| StartName# | string | read | Account name under which the service runs. Depending on the service type, the account name may be in the form of "DomainName\Username" or UPN format (Username@DomainName). The service process will be logged using one of these two forms when it runs. If the account belongs to the built-in domain, ".\Username" can be specified. If NULL is specified, the service will be logged on as the LocalSystem account. For kernel or system-level drivers, StartName contains the driver object name (that is, \FileSystem\Rdr or \Driver\Xns) which the input and output (I/O) system uses to load the device driver. Additionally, if NULL is specified, the driver runs with a default object name created by the I/O system based on the service name. Example: "DWDOM\Admin". Code | |||||||||||||||||||||||||||||||||||||||
| State# | string | read/write | Current state of the base service. Windows Server 2008 and Windows Vista: This property is read-only. Values (8)
CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | |||||||||||||||||||||||||||||||||||||||
| Status# | string | read | Current status of the object. Various operational and nonoperational statuses can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard disk drive, may be functioning properly but predicting a failure in the near future). Nonoperational statuses include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", could apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is online, yet the managed element is neither "OK" nor in one of the other states. Values include the following: Values (12)
Code | |||||||||||||||||||||||||||||||||||||||
| SystemCreationClassName# key | string | read | Type name of the system that hosts this service. Code | |||||||||||||||||||||||||||||||||||||||
| SystemName# key | string | read | Name of the system that hosts this service. Code | |||||||||||||||||||||||||||||||||||||||
| TagId# | uint32 | read | Unique tag value for this service in the group. A value of 0 (zero) indicates that the service has not been assigned a tag. A tag can be used for ordering service star tup within a load order group by specifying a tag order vector in the registry located at: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\GroupOrderList. Tags are only evaluated for Kernel Driver and File System Driver start-type services that have Boot or System start modes. Code |
Methods
Change #
Modifies a service.
uint32 Change(
[in] string DisplayName,
[in] string PathName,
[in] uint8 ServiceType,
[in] uint8 ErrorControl,
[in] string StartMode,
[in] boolean DesktopInteract,
[in] string StartName,
[in] string StartPassword,
[in] string LoadOrderGroup,
[in] string[] LoadOrderGroupDependencies,
[in] string[] ServiceDependencies
);Parameters
| Parameter | Type | Direction | Description |
|---|---|---|---|
| DisplayName | string | in | The display name for a service. This string has a maximum length of 256 characters. The name is case preserved in the service control manager. *DisplayName* comparisons are always case insensitive. Constraints: Accepts the same value as the *Name* parameter. Example: "Atdisk". |
| PathName | string | in | The fully qualified path to the executable file that implements a service. Example: "\SystemRoot\System32\drivers\afd.sys". |
| ServiceType | uint8 | in | Type of services provided to processes that call them. (256) Interactive Process |
| ErrorControl | uint8 | in | Severity of an error if this service does not start during startup. The value indicates the action that the startup program takes if failure occurs. The system logs all errors. |
| StartMode | string | in | Start mode of the Windows base service. |
| DesktopInteract | boolean | in | If True, the service can create or communicate with a window on the desktop. |
| StartName | string | in | Account name that the service runs under, which depends on the service type. The account name may be in the form of DomainName\Username or .\Username. When it runs, the service process is logged by using one of the previous two forms. If the account belongs to the built-in domain, .\Username can be specified. If an empty string is specified, the service is logged on as the LocalSystem account. For kernel or system-level drivers, *StartName* contains the driver object name, for example, \FileSystem\Rdr or \Driver\Xns, which the input and output (I/O) system uses to load the device driver. If NULL is specified, the driver runs with a default object name that the I/O system creates based on the service name, for example, DWDOM\Admin. You also can use the User Principal Name (UPN) format to specify the StartName, for example, *Username@DomainName*. |
| StartPassword | string | in | Password to the account name that the *StartName* parameter specifies. Specify NULL when you do not change the password. Specify an empty string if the service does not have a password. Note: When you change a service from local system to network or from network to local system, *StartPassword* must be an empty string ("") and not NULL. |
| LoadOrderGroup | string | in | Group name that it is associated with. Load order groups are contained in the system registry, and determine the sequence that services are loaded into an operating system. If the pointer is NULL, or points to an empty string, the service does not belong to a group. Dependencies between groups should be listed in the *LoadOrderGroupDependencies* parameter. Services in the load-ordering group list are started first, followed by services in groups not in the load-ordering group list, followed by services that do not belong to a group. The system registry has a list of load ordering groups located at HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ServiceGroupOrder. |
| LoadOrderGroupDependencies | string[] | in | List of load-ordering groups that must start before this service starts. The array is doubly null-terminated. If the pointer is NULL, or if it points to an empty string, the service does not have dependencies. Group names must be prefixed by the SC_GROUP_IDENTIFIER (defined in the Winsvc.h file) character to differentiate them from service names, because services and service groups share the same namespace. Dependency on a group means that this service can run if at least one member of the group is running after an attempt to start all of the members of the group. |
| ServiceDependencies | string[] | in | List that contains the names of services that must start before this service starts. The array is doubly null-terminated. If the pointer is NULL, or points to an empty string, the service does not have dependencies. Dependency on a service means that this service can run only if the service it depends on is running. |
Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | The request is accepted. |
| 1 | Not Supported | The request is not supported. |
| 2 | Access Denied | The user does not have the necessary access privileges. |
| 3 | Dependent Services Running | The service cannot be stopped because other services that are running are dependent on it. |
| 4 | Invalid Service Control | The requested control code is not valid, or is unacceptable to the service. |
| 5 | Service Cannot Accept Control | The requested control code cannot be sent to the service because the State property in the Win32_BaseService object is equal to 0, 1, or 2. |
| 6 | Service Not Active | The service has not been started. |
| 7 | Service Request Timeout | The service does not respond to the start request quickly. |
| 8 | Unknown Failure | Interactive process. |
| 9 | Path Not Found | The directory path to the service executable file is not found. |
| 10 | Service Already Running | The service is already running. |
| 11 | Service Database Locked | The database to add a new service is locked. |
| 12 | Service Dependency Deleted | A dependency for which this service relies on is removed from the system. |
| 13 | Service Dependency Failure | The service does not find the service needed from a dependent service. |
| 14 | Service Disabled | The service is disabled from the system. |
| 15 | Service Logon Failed | The service does not have the correct authentication to run on the system. |
| 16 | Service Marked For Deletion | This service is being removed from the system. |
| 17 | Service No Thread | There is no execution thread for the service. |
| 18 | Status Circular Dependency | There are circular dependencies when starting the service. |
| 19 | Status Duplicate Name | There is a service running under the same name. |
| 20 | Status Invalid Name | There are invalid characters in the name of the service. |
| 21 | Status Invalid Parameter | Invalid parameters have been passed to the service. |
| 22 | Status Invalid Service Account | The account for this service to run under is not valid or does not have the permissions to run the service. |
| 23 | Status Service Exists | The service exists in the database of services available from the system. |
| 24 | Service Already Paused | The service is currently paused in the system. |
| 25..4294967295 | Other |
Call the Change method
review before running# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_BaseService -Filter "Name = 'Example'"
$methodParameters = @{
InputObject = $instance
MethodName = 'Change'
Arguments = @{
DisplayName = 'Example'
PathName = 'Example'
ServiceType = 1
ErrorControl = 1
StartMode = 'Example'
DesktopInteract = $false
StartName = 'Example'
StartPassword = 'Example'
LoadOrderGroup = 'Example'
LoadOrderGroupDependencies = @('Example')
ServiceDependencies = @('Example')
}
WhatIf = $true # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters
# With -WhatIf nothing runs and no result is returned
if ($result) {
$returnValueName = @{
0 = 'Success'
1 = 'Not Supported'
2 = 'Access Denied'
3 = 'Dependent Services Running'
4 = 'Invalid Service Control'
5 = 'Service Cannot Accept Control'
6 = 'Service Not Active'
7 = 'Service Request Timeout'
8 = 'Unknown Failure'
9 = 'Path Not Found'
10 = 'Service Already Running'
11 = 'Service Database Locked'
12 = 'Service Dependency Deleted'
13 = 'Service Dependency Failure'
14 = 'Service Disabled'
15 = 'Service Logon Failed'
16 = 'Service Marked For Deletion'
17 = 'Service No Thread'
18 = 'Status Circular Dependency'
19 = 'Status Duplicate Name'
20 = 'Status Invalid Name'
21 = 'Status Invalid Parameter'
22 = 'Status Invalid Service Account'
23 = 'Status Service Exists'
24 = 'Service Already Paused'
}
$returnValueName[[int]$result.ReturnValue]
}This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.
ChangeStartMode #
Modifies the start mode of a service.
uint32 ChangeStartMode([in] string StartMode);Parameters
| Parameter | Type | Direction | Description |
|---|---|---|---|
| StartMode | string | in | Start mode of the Windows base service. The default is "Automatic". |
Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | The request was accepted. |
| 1 | Not Supported | The request is not supported. |
| 2 | Access Denied | The user did not have the necessary access. |
| 3 | Dependent Services Running | The service cannot be stopped because other services that are running are dependent on it. |
| 4 | Invalid Service Control | The requested control code is not valid, or it is unacceptable to the service. |
| 5 | Service Cannot Accept Control | 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. |
| 6 | Service Not Active | The service has not been started. |
| 7 | Service Request Timeout | The service did not respond to the start request in a timely fashion. |
| 8 | Unknown Failure | Interactive process. |
| 9 | Path Not Found | The directory path to the service executable file was not found. |
| 10 | Service Already Running | The service is already running. |
| 11 | Service Database Locked | The database to add a new service is locked. |
| 12 | Service Dependency Deleted | A dependency on which this service relies has been removed from the system. |
| 13 | Service Dependency Failure | The service failed to find the service needed from a dependent service. |
| 14 | Service Disabled | The service has been disabled from the system. |
| 15 | Service Logon Failed | The service does not have the correct authentication to run on the system. |
| 16 | Service Marked For Deletion | This service is being removed from the system. |
| 17 | Service No Thread | There is no execution thread for the service. |
| 18 | Status Circular Dependency | There are circular dependencies when starting the service. |
| 19 | Status Duplicate Name | There is a service running under the same name. |
| 20 | Status Invalid Name | There are invalid characters in the name of the service. |
| 21 | Status Invalid Parameter | Invalid parameters have been passed to the service. |
| 22 | Status Invalid Service Account | The account which this service is to run under is either invalid or lacks the permissions to run the service. |
| 23 | Status Service Exists | The service exists in the database of services available from the system. |
| 24 | Service Already Paused | The service is currently paused in the system. |
| 25..4294967295 | Other |
Call the ChangeStartMode method
review before running# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_BaseService -Filter "Name = 'Example'"
$methodParameters = @{
InputObject = $instance
MethodName = 'ChangeStartMode'
Arguments = @{ StartMode = 'Example' }
WhatIf = $true # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters
# With -WhatIf nothing runs and no result is returned
if ($result) {
$returnValueName = @{
0 = 'Success'
1 = 'Not Supported'
2 = 'Access Denied'
3 = 'Dependent Services Running'
4 = 'Invalid Service Control'
5 = 'Service Cannot Accept Control'
6 = 'Service Not Active'
7 = 'Service Request Timeout'
8 = 'Unknown Failure'
9 = 'Path Not Found'
10 = 'Service Already Running'
11 = 'Service Database Locked'
12 = 'Service Dependency Deleted'
13 = 'Service Dependency Failure'
14 = 'Service Disabled'
15 = 'Service Logon Failed'
16 = 'Service Marked For Deletion'
17 = 'Service No Thread'
18 = 'Status Circular Dependency'
19 = 'Status Duplicate Name'
20 = 'Status Invalid Name'
21 = 'Status Invalid Parameter'
22 = 'Status Invalid Service Account'
23 = 'Status Service Exists'
24 = 'Service Already Paused'
}
$returnValueName[[int]$result.ReturnValue]
}This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.
Create static#
Creates a new service.
uint32 Create(
[in] string Name,
[in] string DisplayName,
[in] string PathName,
[in] uint8 ServiceType,
[in] uint8 ErrorControl,
[in] string StartMode,
[in] boolean DesktopInteract,
[in] string StartName,
[in] string StartPassword,
[in] string LoadOrderGroup,
[in] string[] LoadOrderGroupDependencies,
[in] string[] ServiceDependencies
);Parameters
| Parameter | Type | Direction | Description |
|---|---|---|---|
| Name | string | in | Name of the service to install to the Create method. The maximum string length is 256 characters. The service control manager database preserves the case of the characters, but service name comparisons are always case-insensitive. Forward-slashes (/) and double back-slashes (\) are invalid service name characters. |
| DisplayName | string | in | Display name of the service. This string has a maximum length of 256 characters. The name is case-preserved in the service control manager. *DisplayName* comparisons are always case-insensitive. Constraints: Accepts the same value as the *Name* parameter. Example: "Atdisk". |
| PathName | string | in | Fully qualified path to the executable file that implements the service. Example: "\SystemRoot\System32\drivers\afd.sys". |
| ServiceType | uint8 | in | Type of services provided to processes that call them. The value is a bitmap. 256 Interactive Process |
| ErrorControl | uint8 | in | Severity of the error if the Create method fails to start. The value indicates the action taken by the startup program if failure occurs. All errors are logged by the system. |
| StartMode | string | in | Start mode of the Windows base service. |
| DesktopInteract | boolean | in | If true, the service can create or communicate with windows on the desktop. |
| StartName | string | in | Account name under which the service runs. Depending on the service type, the account name may be in the form of "DomainName\Username". The service process is logged using one of these two forms when it runs. If the account belongs to the built-in domain, ".\Username" can be specified. If NULL is specified, the service is logged on as the LocalSystem account. For a kernel or system-level drivers, *StartName* contains the driver object name (that is, \FileSystem\Rdr or \Driver\Xns) that the input and output (I/O) system uses to load the device driver. If NULL is specified, the driver runs with a default object name created by the I/O system based on the service name. Example: DWDOM\Admin. |
| StartPassword | string | in | Password to the account name specified by the *StartName* parameter. Specify NULL if you are not changing the password. Specify an empty string if the service has no password. |
| LoadOrderGroup | string | in | Group name associated with the new service. Load order groups are contained in the registry, and determine the sequence in which services are loaded into the operating system. If the pointer is NULL or if it points to an empty string, the service does not belong to a group. Dependencies between groups should be listed in the *LoadOrderGroupDependencies* parameter. Services in the load-ordering group list are started first, followed by services in groups not in the load-ordering group list, followed by services that do not belong to a group. The registry has a list of load ordering groups located at: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\ServiceGroupOrder |
| LoadOrderGroupDependencies | string[] | in | Array of load-ordering groups that must start before this service. Each item in the array is delimited by NULL and the list is terminated by two NULL values. In Visual Basic or script you can pass a vbArray. If the pointer is NULL or if it points to an empty string, the service has no dependencies. Group names must be prefixed by the SC_GROUP_IDENTIFIER (defined in the Winsvc.h file) character to differentiate it from a service name, because services and service groups share the same namespace. Dependency on a group means that this service can run if at least one member of the group is running after an attempt to start all members of the group. |
| ServiceDependencies | string[] | in | Array that contains names of services that must start before this service starts. Each item in the array is delimited by NULL and the list is terminated by two NULL values. In Visual Basic or script you can pass a vbArray. If the pointer is NULL, or if it points to an empty string, the service has no dependencies. Dependency on a service means that this service can only run if the service it depends on is running. |
Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | The request was accepted. |
| 1 | Not Supported | The request is not supported. |
| 2 | Access Denied | The user did not have the necessary access. |
| 3 | Dependent Services Running | The service cannot be stopped because other services that are running are dependent on it. |
| 4 | Invalid Service Control | The requested control code is not valid, or it is unacceptable to the service. |
| 5 | Service Cannot Accept Control | 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. |
| 6 | Service Not Active | The service has not been started. |
| 7 | Service Request Timeout | The service did not respond to the start request in a timely fashion. |
| 8 | Unknown Failure | Interactive process. |
| 9 | Path Not Found | The directory path to the service executable file was not found. |
| 10 | Service Already Running | The service is already running. |
| 11 | Service Database Locked | The database to add a new service is locked. |
| 12 | Service Dependency Deleted | A dependency on which this service relies has been removed from the system. |
| 13 | Service Dependency Failure | The service failed to find the service needed from a dependent service. |
| 14 | Service Disabled | The service has been disabled from the system. |
| 15 | Service Logon Failed | The service does not have the correct authentication to run on the system. |
| 16 | Service Marked For Deletion | This service is being removed from the system. |
| 17 | Service No Thread | There is no execution thread for the service. |
| 18 | Status Circular Dependency | There are circular dependencies when starting the service. |
| 19 | Status Duplicate Name | There is a service running under the same name. |
| 20 | Status Invalid Name | There are invalid characters in the name of the service. |
| 21 | Status Invalid Parameter | Invalid parameters have been passed to the service. |
| 22 | Status Invalid Service Account | The account which this service is to run under is either invalid or lacks the permissions to run the service. |
| 23 | Status Service Exists | The service exists in the database of services available from the system. |
| 24 | Service Already Paused | The service is currently paused in the system. |
| 25..4294967295 | Other |
Call the Create method
review before running# Warning: this method can change the system. -WhatIf shows the operation without running it.
$methodParameters = @{
ClassName = 'Win32_BaseService'
MethodName = 'Create'
Arguments = @{
Name = 'Example'
DisplayName = 'Example'
PathName = 'Example'
ServiceType = 1
ErrorControl = 1
StartMode = 'Example'
DesktopInteract = $false
StartName = 'Example'
StartPassword = 'Example'
LoadOrderGroup = 'Example'
LoadOrderGroupDependencies = @('Example')
ServiceDependencies = @('Example')
}
WhatIf = $true # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters
# With -WhatIf nothing runs and no result is returned
if ($result) {
$returnValueName = @{
0 = 'Success'
1 = 'Not Supported'
2 = 'Access Denied'
3 = 'Dependent Services Running'
4 = 'Invalid Service Control'
5 = 'Service Cannot Accept Control'
6 = 'Service Not Active'
7 = 'Service Request Timeout'
8 = 'Unknown Failure'
9 = 'Path Not Found'
10 = 'Service Already Running'
11 = 'Service Database Locked'
12 = 'Service Dependency Deleted'
13 = 'Service Dependency Failure'
14 = 'Service Disabled'
15 = 'Service Logon Failed'
16 = 'Service Marked For Deletion'
17 = 'Service No Thread'
18 = 'Status Circular Dependency'
19 = 'Status Duplicate Name'
20 = 'Status Invalid Name'
21 = 'Status Invalid Parameter'
22 = 'Status Invalid Service Account'
23 = 'Status Service Exists'
24 = 'Service Already Paused'
}
$returnValueName[[int]$result.ReturnValue]
}This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.
Delete #
Deletes an existing service.
uint32 Delete();Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | The request was accepted. |
| 1 | Not Supported | The request is not supported. |
| 2 | Access Denied | The user did not have the necessary access. |
| 3 | Dependent Services Running | The service cannot be stopped because other services that are running are dependent on it. |
| 4 | Invalid Service Control | The requested control code is not valid, or it is unacceptable to the service. |
| 5 | Service Cannot Accept Control | 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. |
| 6 | Service Not Active | The service has not been started. |
| 7 | Service Request Timeout | The service did not respond to the start request in a timely fashion. |
| 8 | Unknown Failure | Interactive process. |
| 9 | Path Not Found | The directory path to the service executable file was not found. |
| 10 | Service Already Running | The service is already running. |
| 11 | Service Database Locked | The database to add a new service is locked. |
| 12 | Service Dependency Deleted | A dependency on which this service relies has been removed from the system. |
| 13 | Service Dependency Failure | The service failed to find the service needed from a dependent service. |
| 14 | Service Disabled | The service has been disabled from the system. |
| 15 | Service Logon Failed | The service does not have the correct authentication to run on the system. |
| 16 | Service Marked For Deletion | This service is being removed from the system. |
| 17 | Service No Thread | There is no execution thread for the service. |
| 18 | Status Circular Dependency | There are circular dependencies when starting the service. |
| 19 | Status Duplicate Name | There is a service running under the same name. |
| 20 | Status Invalid Name | There are invalid characters in the name of the service. |
| 21 | Status Invalid Parameter | Invalid parameters have been passed to the service. |
| 22 | Status Invalid Service Account | The account which this service is to run under is either invalid or lacks the permissions to run the service. |
| 23 | Status Service Exists | The service exists in the database of services available from the system. |
| 24 | Service Already Paused | The service is currently paused in the system. |
| 25..4294967295 | Other |
Call the Delete method
review before running# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_BaseService -Filter "Name = 'Example'"
$methodParameters = @{
InputObject = $instance
MethodName = 'Delete'
WhatIf = $true # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters
# With -WhatIf nothing runs and no result is returned
if ($result) {
$returnValueName = @{
0 = 'Success'
1 = 'Not Supported'
2 = 'Access Denied'
3 = 'Dependent Services Running'
4 = 'Invalid Service Control'
5 = 'Service Cannot Accept Control'
6 = 'Service Not Active'
7 = 'Service Request Timeout'
8 = 'Unknown Failure'
9 = 'Path Not Found'
10 = 'Service Already Running'
11 = 'Service Database Locked'
12 = 'Service Dependency Deleted'
13 = 'Service Dependency Failure'
14 = 'Service Disabled'
15 = 'Service Logon Failed'
16 = 'Service Marked For Deletion'
17 = 'Service No Thread'
18 = 'Status Circular Dependency'
19 = 'Status Duplicate Name'
20 = 'Status Invalid Name'
21 = 'Status Invalid Parameter'
22 = 'Status Invalid Service Account'
23 = 'Status Service Exists'
24 = 'Service Already Paused'
}
$returnValueName[[int]$result.ReturnValue]
}This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.
InterrogateService #
Requests that the service update its state to the service manager.
uint32 InterrogateService();Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | The request was accepted. |
| 1 | Not Supported | The request is not supported. |
| 2 | Access Denied | The user did not have the necessary access. |
| 3 | Dependent Services Running | The service cannot be stopped because other services that are running are dependent on it. |
| 4 | Invalid Service Control | The requested control code is not valid, or it is unacceptable to the service. |
| 5 | Service Cannot Accept Control | 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. |
| 6 | Service Not Active | The service has not been started. |
| 7 | Service Request Timeout | The service did not respond to the start request in a timely fashion. |
| 8 | Unknown Failure | Interactive process. |
| 9 | Path Not Found | The directory path to the service executable file was not found. |
| 10 | Service Already Running | The service is already running. |
| 11 | Service Database Locked | The database to add a new service is locked. |
| 12 | Service Dependency Deleted | A dependency on which this service relies has been removed from the system. |
| 13 | Service Dependency Failure | The service failed to find the service needed from a dependent service. |
| 14 | Service Disabled | The service has been disabled from the system. |
| 15 | Service Logon Failed | The service does not have the correct authentication to run on the system. |
| 16 | Service Marked For Deletion | This service is being removed from the system. |
| 17 | Service No Thread | There is no execution thread for the service. |
| 18 | Status Circular Dependency | There are circular dependencies when starting the service. |
| 19 | Status Duplicate Name | There is a service running under the same name. |
| 20 | Status Invalid Name | There are invalid characters in the name of the service. |
| 21 | Status Invalid Parameter | Invalid parameters have been passed to the service. |
| 22 | Status Invalid Service Account | The account which this service is to run under is either invalid or lacks the permissions to run the service. |
| 23 | Status Service Exists | The service exists in the database of services available from the system. |
| 24 | Service Already Paused | The service is currently paused in the system. |
| 25..4294967295 | Other |
Call the InterrogateService method
review before running# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_BaseService -Filter "Name = 'Example'"
$methodParameters = @{
InputObject = $instance
MethodName = 'InterrogateService'
WhatIf = $true # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters
# With -WhatIf nothing runs and no result is returned
if ($result) {
$returnValueName = @{
0 = 'Success'
1 = 'Not Supported'
2 = 'Access Denied'
3 = 'Dependent Services Running'
4 = 'Invalid Service Control'
5 = 'Service Cannot Accept Control'
6 = 'Service Not Active'
7 = 'Service Request Timeout'
8 = 'Unknown Failure'
9 = 'Path Not Found'
10 = 'Service Already Running'
11 = 'Service Database Locked'
12 = 'Service Dependency Deleted'
13 = 'Service Dependency Failure'
14 = 'Service Disabled'
15 = 'Service Logon Failed'
16 = 'Service Marked For Deletion'
17 = 'Service No Thread'
18 = 'Status Circular Dependency'
19 = 'Status Duplicate Name'
20 = 'Status Invalid Name'
21 = 'Status Invalid Parameter'
22 = 'Status Invalid Service Account'
23 = 'Status Service Exists'
24 = 'Service Already Paused'
}
$returnValueName[[int]$result.ReturnValue]
}This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.
PauseService #
Attempts to place the service in the paused state.
uint32 PauseService();Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | The request was accepted. |
| 1 | Not Supported | The request is not supported. |
| 2 | Access Denied | The user did not have the necessary access. |
| 3 | Dependent Services Running | The service cannot be stopped because other services that are running are dependent on it. |
| 4 | Invalid Service Control | The requested control code is not valid, or it is unacceptable to the service. |
| 5 | Service Cannot Accept Control | 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. |
| 6 | Service Not Active | The service has not been started. |
| 7 | Service Request Timeout | The service did not respond to the start request in a timely fashion. |
| 8 | Unknown Failure | Interactive process. |
| 9 | Path Not Found | The directory path to the service executable file was not found. |
| 10 | Service Already Running | The service is already running. |
| 11 | Service Database Locked | The database to add a new service is locked. |
| 12 | Service Dependency Deleted | A dependency on which this service relies has been removed from the system. |
| 13 | Service Dependency Failure | The service failed to find the service needed from a dependent service. |
| 14 | Service Disabled | The service has been disabled from the system. |
| 15 | Service Logon Failed | The service does not have the correct authentication to run on the system. |
| 16 | Service Marked For Deletion | This service is being removed from the system. |
| 17 | Service No Thread | There is no execution thread for the service. |
| 18 | Status Circular Dependency | There are circular dependencies when starting the service. |
| 19 | Status Duplicate Name | There is a service running under the same name. |
| 20 | Status Invalid Name | There are invalid characters in the name of the service. |
| 21 | Status Invalid Parameter | Invalid parameters have been passed to the service. |
| 22 | Status Invalid Service Account | The account which this service is to run under is either invalid or lacks the permissions to run the service. |
| 23 | Status Service Exists | The service exists in the database of services available from the system. |
| 24 | Service Already Paused | The service is currently paused in the system. |
| 25..4294967295 | Other |
Call the PauseService method
review before running# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_BaseService -Filter "Name = 'Example'"
$methodParameters = @{
InputObject = $instance
MethodName = 'PauseService'
WhatIf = $true # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters
# With -WhatIf nothing runs and no result is returned
if ($result) {
$returnValueName = @{
0 = 'Success'
1 = 'Not Supported'
2 = 'Access Denied'
3 = 'Dependent Services Running'
4 = 'Invalid Service Control'
5 = 'Service Cannot Accept Control'
6 = 'Service Not Active'
7 = 'Service Request Timeout'
8 = 'Unknown Failure'
9 = 'Path Not Found'
10 = 'Service Already Running'
11 = 'Service Database Locked'
12 = 'Service Dependency Deleted'
13 = 'Service Dependency Failure'
14 = 'Service Disabled'
15 = 'Service Logon Failed'
16 = 'Service Marked For Deletion'
17 = 'Service No Thread'
18 = 'Status Circular Dependency'
19 = 'Status Duplicate Name'
20 = 'Status Invalid Name'
21 = 'Status Invalid Parameter'
22 = 'Status Invalid Service Account'
23 = 'Status Service Exists'
24 = 'Service Already Paused'
}
$returnValueName[[int]$result.ReturnValue]
}This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.
ResumeService #
Attempts to place the service in the resumed state.
uint32 ResumeService();Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | The request was accepted. |
| 1 | Not Supported | The request is not supported. |
| 2 | Access Denied | The user did not have the necessary access. |
| 3 | Dependent Services Running | The service cannot be stopped because other services that are running are dependent on it. |
| 4 | Invalid Service Control | The requested control code is not valid, or it is unacceptable to the service. |
| 5 | Service Cannot Accept Control | 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. |
| 6 | Service Not Active | The service has not been started. |
| 7 | Service Request Timeout | The service did not respond to the start request in a timely fashion. |
| 8 | Unknown Failure | Interactive process. |
| 9 | Path Not Found | The directory path to the service executable file was not found. |
| 10 | Service Already Running | The service is already running. |
| 11 | Service Database Locked | The database to add a new service is locked. |
| 12 | Service Dependency Deleted | A dependency on which this service relies has been removed from the system. |
| 13 | Service Dependency Failure | The service failed to find the service needed from a dependent service. |
| 14 | Service Disabled | The service has been disabled from the system. |
| 15 | Service Logon Failed | The service does not have the correct authentication to run on the system. |
| 16 | Service Marked For Deletion | This service is being removed from the system. |
| 17 | Service No Thread | There is no execution thread for the service. |
| 18 | Status Circular Dependency | There are circular dependencies when starting the service. |
| 19 | Status Duplicate Name | There is a service running under the same name. |
| 20 | Status Invalid Name | There are invalid characters in the name of the service. |
| 21 | Status Invalid Parameter | Invalid parameters have been passed to the service. |
| 22 | Status Invalid Service Account | The account which this service is to run under is either invalid or lacks the permissions to run the service. |
| 23 | Status Service Exists | The service exists in the database of services available from the system. |
| 24 | Service Already Paused | The service is currently paused in the system. |
| 25..4294967295 | Other |
Call the ResumeService method
review before running# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_BaseService -Filter "Name = 'Example'"
$methodParameters = @{
InputObject = $instance
MethodName = 'ResumeService'
WhatIf = $true # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters
# With -WhatIf nothing runs and no result is returned
if ($result) {
$returnValueName = @{
0 = 'Success'
1 = 'Not Supported'
2 = 'Access Denied'
3 = 'Dependent Services Running'
4 = 'Invalid Service Control'
5 = 'Service Cannot Accept Control'
6 = 'Service Not Active'
7 = 'Service Request Timeout'
8 = 'Unknown Failure'
9 = 'Path Not Found'
10 = 'Service Already Running'
11 = 'Service Database Locked'
12 = 'Service Dependency Deleted'
13 = 'Service Dependency Failure'
14 = 'Service Disabled'
15 = 'Service Logon Failed'
16 = 'Service Marked For Deletion'
17 = 'Service No Thread'
18 = 'Status Circular Dependency'
19 = 'Status Duplicate Name'
20 = 'Status Invalid Name'
21 = 'Status Invalid Parameter'
22 = 'Status Invalid Service Account'
23 = 'Status Service Exists'
24 = 'Service Already Paused'
}
$returnValueName[[int]$result.ReturnValue]
}This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.
StartService #
Attempts to place the service into its startup state.
uint32 StartService();Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | The request was accepted. |
| 1 | Not Supported | The request is not supported. |
| 2 | Access Denied | The user did not have the necessary access. |
| 3 | Dependent Services Running | The service cannot be stopped because other services that are running are dependent on it. |
| 4 | Invalid Service Control | The requested control code is not valid, or it is unacceptable to the service. |
| 5 | Service Cannot Accept Control | 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. |
| 6 | Service Not Active | The service has not been started. |
| 7 | Service Request Timeout | The service did not respond to the start request in a timely fashion. |
| 8 | Unknown Failure | Interactive process. |
| 9 | Path Not Found | The directory path to the service executable file was not found. |
| 10 | Service Already Running | The service is already running. |
| 11 | Service Database Locked | The database to add a new service is locked. |
| 12 | Service Dependency Deleted | A dependency on which this service relies has been removed from the system. |
| 13 | Service Dependency Failure | The service failed to find the service needed from a dependent service. |
| 14 | Service Disabled | The service has been disabled from the system. |
| 15 | Service Logon Failed | The service does not have the correct authentication to run on the system. |
| 16 | Service Marked For Deletion | This service is being removed from the system. |
| 17 | Service No Thread | There is no execution thread for the service. |
| 18 | Status Circular Dependency | There are circular dependencies when starting the service. |
| 19 | Status Duplicate Name | There is a service running under the same name. |
| 20 | Status Invalid Name | There are invalid characters in the name of the service. |
| 21 | Status Invalid Parameter | Invalid parameters have been passed to the service. |
| 22 | Status Invalid Service Account | The account which this service is to run under is either invalid or lacks the permissions to run the service. |
| 23 | Status Service Exists | The service exists in the database of services available from the system. |
| 24 | Service Already Paused | The service is currently paused in the system. |
| 25..4294967295 | Other |
Call the StartService method
review before running# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_BaseService -Filter "Name = 'Example'"
$methodParameters = @{
InputObject = $instance
MethodName = 'StartService'
WhatIf = $true # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters
# With -WhatIf nothing runs and no result is returned
if ($result) {
$returnValueName = @{
0 = 'Success'
1 = 'Not Supported'
2 = 'Access Denied'
3 = 'Dependent Services Running'
4 = 'Invalid Service Control'
5 = 'Service Cannot Accept Control'
6 = 'Service Not Active'
7 = 'Service Request Timeout'
8 = 'Unknown Failure'
9 = 'Path Not Found'
10 = 'Service Already Running'
11 = 'Service Database Locked'
12 = 'Service Dependency Deleted'
13 = 'Service Dependency Failure'
14 = 'Service Disabled'
15 = 'Service Logon Failed'
16 = 'Service Marked For Deletion'
17 = 'Service No Thread'
18 = 'Status Circular Dependency'
19 = 'Status Duplicate Name'
20 = 'Status Invalid Name'
21 = 'Status Invalid Parameter'
22 = 'Status Invalid Service Account'
23 = 'Status Service Exists'
24 = 'Service Already Paused'
}
$returnValueName[[int]$result.ReturnValue]
}This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.
StopService #
Class method that places the service in the stopped state.
uint32 StopService();Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | The request was accepted. |
| 1 | Not Supported | The request is not supported. |
| 2 | Access Denied | The user did not have the necessary access. |
| 3 | Dependent Services Running | The service cannot be stopped because other services that are running are dependent on it. |
| 4 | Invalid Service Control | The requested control code is not valid, or it is unacceptable to the service. |
| 5 | Service Cannot Accept Control | 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. |
| 6 | Service Not Active | The service has not been started. |
| 7 | Service Request Timeout | The service did not respond to the start request in a timely fashion. |
| 8 | Unknown Failure | Interactive process. |
| 9 | Path Not Found | The directory path to the service executable file was not found. |
| 10 | Service Already Running | The service is already running. |
| 11 | Service Database Locked | The database to add a new service is locked. |
| 12 | Service Dependency Deleted | A dependency on which this service relies has been removed from the system. |
| 13 | Service Dependency Failure | The service failed to find the service required from a dependent service. |
| 14 | Service Disabled | The service has been disabled from the system. |
| 15 | Service Logon Failed | The service does not have the correct authentication to run on the system. |
| 16 | Service Marked For Deletion | This service is being removed from the system. |
| 17 | Service No Thread | There is no execution thread for the service. |
| 18 | Status Circular Dependency | There are circular dependencies when starting the service. |
| 19 | Status Duplicate Name | There is a service running under the same name. |
| 20 | Status Invalid Name | There are invalid characters in the name of the service. |
| 21 | Status Invalid Parameter | Invalid parameters have been passed to the service. |
| 22 | Status Invalid Service Account | The account which this service is to run under is either invalid or lacks the permissions to run the service. |
| 23 | Status Service Exists | The service exists in the database of services available from the system. |
| 24 | Service Already Paused | The service is currently paused in the system. |
| 25..4294967295 | Other |
Call the StopService method
review before running# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_BaseService -Filter "Name = 'Example'"
$methodParameters = @{
InputObject = $instance
MethodName = 'StopService'
WhatIf = $true # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters
# With -WhatIf nothing runs and no result is returned
if ($result) {
$returnValueName = @{
0 = 'Success'
1 = 'Not Supported'
2 = 'Access Denied'
3 = 'Dependent Services Running'
4 = 'Invalid Service Control'
5 = 'Service Cannot Accept Control'
6 = 'Service Not Active'
7 = 'Service Request Timeout'
8 = 'Unknown Failure'
9 = 'Path Not Found'
10 = 'Service Already Running'
11 = 'Service Database Locked'
12 = 'Service Dependency Deleted'
13 = 'Service Dependency Failure'
14 = 'Service Disabled'
15 = 'Service Logon Failed'
16 = 'Service Marked For Deletion'
17 = 'Service No Thread'
18 = 'Status Circular Dependency'
19 = 'Status Duplicate Name'
20 = 'Status Invalid Name'
21 = 'Status Invalid Parameter'
22 = 'Status Invalid Service Account'
23 = 'Status Service Exists'
24 = 'Service Already Paused'
}
$returnValueName[[int]$result.ReturnValue]
}This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.
UserControlService #
Attempts to send a user-defined control code to a service.
uint32 UserControlService([in] uint8 ControlCode);Parameters
| Parameter | Type | Direction | Description |
|---|---|---|---|
| ControlCode | uint8 | 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: |
Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | The request is accepted. |
| 1 | Not Supported | The request is not supported. |
| 2 | Access Denied | The user does not have the necessary access rights. |
| 3 | Dependent Services Running | The service cannot be stopped because other services that are running are dependent on it. |
| 4 | Invalid Service Control | The requested control code is not valid, or it is unacceptable to the service. |
| 5 | Service Cannot Accept Control | 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. |
| 6 | Service Not Active | The service has not started. |
| 7 | Service Request Timeout | The service does not respond to the start request quickly. |
| 8 | Unknown Failure | Interactive process. |
| 9 | Path Not Found | The directory path to the service executable file is not found. |
| 10 | Service Already Running | The service is already running. |
| 11 | Service Database Locked | The database to add a new service is locked. |
| 12 | Service Dependency Deleted | A dependency that this service relies on is removed from the system. |
| 13 | Service Dependency Failure | The service does not find the service needed from a dependent service. |
| 14 | Service Disabled | The service is disabled from the system. |
| 15 | Service Logon Failed | The service does not have the correct authentication to run on the system. |
| 16 | Service Marked For Deletion | The service is being removed from the system. |
| 17 | Service No Thread | There is no execution thread for the service. |
| 18 | Status Circular Dependency | There are circular dependencies when starting the service. |
| 19 | Status Duplicate Name | There is a service running under the same name. |
| 20 | Status Invalid Name | There are invalid characters in the name of the service. |
| 21 | Status Invalid Parameter | Invalid parameters have passed to the service. |
| 22 | Status Invalid Service Account | The account that this service runs under is not valid or does not have the permissions to run the service. |
| 23 | Status Service Exists | The service exists in the database of services available from the system. |
| 24 | Service Already Paused | The service is currently paused in the system. |
| 25..4294967295 | Other |
Call the UserControlService method
review before running# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_BaseService -Filter "Name = 'Example'"
$methodParameters = @{
InputObject = $instance
MethodName = 'UserControlService'
Arguments = @{ ControlCode = 0 }
WhatIf = $true # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters
# With -WhatIf nothing runs and no result is returned
if ($result) {
$returnValueName = @{
0 = 'Success'
1 = 'Not Supported'
2 = 'Access Denied'
3 = 'Dependent Services Running'
4 = 'Invalid Service Control'
5 = 'Service Cannot Accept Control'
6 = 'Service Not Active'
7 = 'Service Request Timeout'
8 = 'Unknown Failure'
9 = 'Path Not Found'
10 = 'Service Already Running'
11 = 'Service Database Locked'
12 = 'Service Dependency Deleted'
13 = 'Service Dependency Failure'
14 = 'Service Disabled'
15 = 'Service Logon Failed'
16 = 'Service Marked For Deletion'
17 = 'Service No Thread'
18 = 'Status Circular Dependency'
19 = 'Status Duplicate Name'
20 = 'Status Invalid Name'
21 = 'Status Invalid Parameter'
22 = 'Status Invalid Service Account'
23 = 'Status Service Exists'
24 = 'Service Already Paused'
}
$returnValueName[[int]$result.ReturnValue]
}This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.
Remarks
The Win32_BaseService class is derived from CIM_Service.
Inheritance
Superclass chain
- CIM_ManagedSystemElement
- CIM_LogicalElement
- CIM_Service
- Win32_BaseService
Known subclasses
Requirements
- Namespace
- root/cimv2
- Minimum client
- Windows Vista
- Minimum server
- Windows Server 2008
- Provider
- CIMWin32
- MOF file
- CIMWin32.mof
- DLL
- CIMWin32.dll
Class qualifiers
SupportsCreate CreateBy("Create") SupportsDelete DeleteBy("DeleteInstance") Abstract Provider("CIMWin32") UUID("{8502C4C4-5FBB-11D2-AAC1-006008C78BC7}") DisplayName("System Drivers and Services") AMENDMENT
Microsoft source
Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.