Win32_Service

The Win32_Service class represents a service on a Win32 computer system. A service application conforms to the interface rules of the Service Control Manager (SCM) and can be started by a user automatically at system boot through the Services control panel utility, or by an application that uses the service functions included in the Win32 API. Services can execute even when no user is logged on to the system.

Quick Start

Properties

Most WMI properties are read-only. You can only read values but not change them. Few properties are also writeable. You can assign new values to those properties.

Writeable properties are marked with this icon:   

AcceptPause

Data type Boolean

The AcceptPause property indicates whether the service can be paused.

Values: $true or $false. A value of $true indicates the service can be paused.

AcceptStop

Data type Boolean

The AcceptStop property indicates whether the service can be stopped.

Values: $true or $false. A value of $true indicates the service can be stopped.

Caption

Data type String

The Caption property is a short textual description (one-line string) of the object.

CheckPoint

Data type UInt32

The CheckPoint property specifies a value that the service increments periodically to report its progress during a lengthy start, stop, pause, or continue operation. For example, the service should increment this value as it completes each step of its initialization when it is starting up. The user interface program that invoked the operation on the service uses this value to track the progress of the service during a lengthy operation. This value is not valid and should be zero when the service does not have a start, stop, pause, or continue operation pending.

CreationClassName

Data type String

CreationClassName indicates the name of the class or the subclass used in the creation of an instance. When used with the other key properties of this class, this property allows all instances of this class and its subclasses to be uniquely identified.

Description

Data type String

The Description property provides a textual description of the object.

DesktopInteract

Data type Boolean

The DesktopInteract property indicates whether the service can create or communicate with windows on the desktop.

Values: $true or $false. A value of $true indicates the service can create or communicate with windows on the desktop.

DisplayName

Data type String

The DisplayName property indicates the 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 property.

Example: Atdisk.

ErrorControl

Data type String

If this service fails to start during startup, the ErrorControl property specifies the severity of the error. The value indicates the action taken by the startup program if failure occurs. All errors are logged by the computer system. The computer system does not notify the user of “Ignore” errors. With “Normal” errors the user is notified. With “Severe” errors, the system is restarted with the last-known-good configuration. Finally, on”Critical” errors the system attempts to restart with a good configuration.

'Ignore','Normal','Severe','Critical','Unknown'

ExitCode

Data type UInt32

The ExitCode property specifies a Win32 error code 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 member. The service sets this value to NO_ERROR when running, and again upon normal termination.

InstallDate

Data type DateTime

The InstallDate property is datetime value indicating when the object was installed. A lack of a value does not indicate that the object is not installed.

Name

Data type String

The Name property uniquely identifies the service and provides an indication of the functionality that is managed. This functionality is described in more detail in the object’s Description property.

PathName

Data type String

The PathName property contains the fully qualified path to the service binary file that implements the service.

Example: \SystemRoot\System32\drivers\afd.sys

ProcessId

Data type UInt32

The ProcessId property specifies the process identifier of the service.

Example: 324

ServiceSpecificExitCode

Data type UInt32

The ServiceSpecificExitCode property specifies a 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.

ServiceType

Data type String

The ServiceType property supplies the type of service provided to calling processes.

'Kernel Driver','File System Driver','Adapter','Recognizer Driver','Own Process','Share Process','Interactive Process'

Started

Data type Boolean

Started is a boolean indicating whether the service has been started ($true), or stopped ($false).

StartMode

Data type String

The StartMode property indicates the start mode of the Win32 base service. “Boot” specifies a device driver started by the operating system loader. This value is valid only for driver services. “System” specifies a device driver started by the IoInitSystem function. This value is valid only for driver services. “Automatic” specifies a service to be started automatically by the service control manager during system startup. “Manual” specifies a service to be started by the service control manager when a process calls the StartService function. “Disabled” specifies a service that can no longer be started.

'Boot','System','Auto','Manual','Disabled'

StartName

Data type String

The StartName property indicates the 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 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.

  State

Data type String

The State property indicates the current state of the base service.

'Stopped','Start Pending','Stop Pending','Running','Continue Pending','Pause Pending','Paused','Unknown'

Status

Data type String

The Status property is a string indicating the current status of the object. Various operational and non-operational statuses can be defined. Operational statuses are “OK”, “Degraded” and “Pred Fail”. “Pred Fail” indicates that an element may be functioning properly but predicting a failure in the near future. An example is a SMART-enabled hard drive. Non-operational statuses can also be specified. These are “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 on-line, yet the managed element is neither “OK” nor in one of the other states.

'OK','Error','Degraded','Unknown','Pred Fail','Starting','Stopping','Service','Stressed','NonRecover','No Contact','Lost Comm'

SystemCreationClassName

Data type String

The scoping System’s CreationClassName.

SystemName

Data type String

The name of the system that hosts this service

TagId

Data type UInt32

The TagId property specifies a unique tag value for this service in the group. A value of 0 indicates that the service has not been assigned a tag. A tag can be used for ordering service startup 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.

WaitHint

Data type UInt32

The WaitHint property specifies the estimated time required (in milliseconds) for a pending start, stop, pause, or continue operation. After the specified amount of time has elapsed, the service makes its next call to the SetServiceStatus function with either an incremented CheckPoint value or a change in Current State. If the amount of time specified by WaitHint passes, and CheckPoint has not been incremented, or the Current State has not changed, the service control manager or service control program assumes that an error has occurred.

Methods

Examples

See Also

Help and Questions

  Community Content

You are cordially invited to add knowledge to this page. If you have sample code or additional information related to this WMI class, please share it. Use the comment form to send your information. We will edit and incorparate it into the reference library. Thank you!

Please do not use the comment form to submit questions. If you have questions or need assistance, visit our free forum: Help me with WMI.

Content last updated: 2013-12-27 12:21:15 (UTC).

Facebooktwittergoogle_pluspinterestlinkedinFacebooktwittergoogle_pluspinterestlinkedin