PauseService method of the Win32_SystemDriver class
The PauseService WMI class method attempts to place the service managed by the logical system driver in the paused state.
This topic uses Managed Object Format (MOF) syntax. For more information about using this method, see Calling a Method.
Syntax
uint32 PauseService();
Parameters
This method has no parameters.
Return value
Returns a value of 0 (zero) if the PauseService request was accepted, 1 (one) if the request is not supported, and any other number to indicate an error.
-
0
-
The request was accepted.
-
1
-
The request is not supported.
-
2
-
The user did not have the necessary access.
-
3
-
The service cannot be stopped because other services that are running are dependent on it.
-
4
-
The requested control code is not valid, or it is unacceptable to the service.
-
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.
-
6
-
The service has not been started.
-
7
-
The service did not respond to the start request in a timely fashion.
-
8
-
An unknown failure occurred when starting the service.
-
9
-
The directory path to the service executable file was not found.
-
10
-
The service is already running.
-
11
-
The database to add a new service is locked.
-
12
-
A dependency for which this service relies on has been removed from the system.
-
13
-
The service failed to find the service needed from a dependent service.
-
14
-
The service has been disabled from the system.
-
15
-
The service does not have the correct authentication to run on the system.
-
16
-
This service is being removed from the system.
-
17
-
There is no execution thread for the service.
-
18
-
There are circular dependencies when starting the service.
-
19
-
There is a service running under the same name.
-
20
-
There are invalid characters in the name of the service.
-
21
-
Invalid parameters have been passed to the service.
-
22
-
The account which this service is to run under is either invalid or lacks the permissions to run the service.
-
23
-
The service exists in the database of services available from the system.
-
24
-
The service is currently paused in the system.
Examples
The following PowerShell code attempts to pause the "Microsoft USB Printer class" service.
$usbPrintDriver = Get-WmiObject -query "SELECT * FROM Win32_SystemDriver WHERE Name = 'usbprint'"
$Return = $usbPrintDriver.PauseService()
"Pause Service called. The return value is " + $return.ReturnValue + "."
"To figure out what this means, go look at the docs above this code snippet."
Requirements
Requirement | Value |
---|---|
Minimum supported client |
Windows Vista |
Minimum supported server |
Windows Server 2008 |
Namespace |
Root\CIMV2 |
MOF |
|
DLL |
|
See also
Feedback
https://aka.ms/ContentUserFeedback.
Binnenkort beschikbaar: In de loop van 2024 zullen we GitHub-problemen geleidelijk uitfaseren als het feedbackmechanisme voor inhoud en deze vervangen door een nieuw feedbacksysteem. Zie voor meer informatie:Feedback verzenden en weergeven voor