Retrieving Service Properties

Microsoft® Windows® 2000 Scripting Guide

To effectively manage services in your organization, you need a detailed understanding of the properties of those services. You need to know which services are configured to automatically start whenever a computer is started, and which services need to be manually restarted. You also need to know the user account under which each service is running and whether the service runs as part of a service group.

You can use the WMI Win32_Service class to retrieve the properties of all the services installed on all the computers on your network. Some of the important service properties available through the Win32_Service class are listed in Table 15.1.

Table 15.1 Service Properties Available from the Win32_Service Class




Indicates whether the service can be paused.


Indicates whether the service can be stopped.


Description of the service.


Indicates whether the service can create or communicate with windows on the desktop, and thus interact in some way with a user. Interactive services must run under the Local System account. Most services are not interactive; that is, they do not communicate with the user in any way.


Name of the service as viewed in the Services snap-in. Note that the display name and the service name (which is stored in the registry) are not always the same. For example, the DHCP Client service has the service name Dhcp but the display name DHCP Client.


Action to be taken if a service fails during startup. Values and their associated actions include:

  • Ignore - User is not notified.

  • Normal - Message box displays notifying the user of the problem.

  • Severe - Computer restarts with last-known good configuration.

  • Critical - Computer attempts to restart with a good configuration. If the service fails to start a second time, startup fails.


Error code defining any problems that were encountered when starting or stopping a service. If a service is able to properly start or stop, this value is set to 0 (no error).


Unique name of the service as stored in the registry.


Fully qualified path to the executable file responsible for implementing the service.


Process identifier assigned to the service during startup.


Valid service types include:

  • Kernel Driver

  • File System Driver

  • Adapter

  • Recognizer Driver

  • Own Process

  • Win32 Share Process

  • Interactive Process


Indicates whether or not the service is started.


Values include:

  • Boot. Device driver started by the operating system loader during computer startup.

  • System. Device driver started during kernel initialization.

  • Auto. Service automatically started by the SCM during system startup. Auto services are started even if a user does not log on.

  • Manual. Service that must be manually started, either by using a script or a batch file or by using the Services snap-in. These services do not start unless a user logs on and starts them.

  • Disabled. Service that cannot be started until its StartMode is changed to either Auto or Manual.


Account name under which the service runs. Although many services run under the LocalSystem account by default, services can run under any valid local or domain user account. The service is limited to the privileges and access rights belonging to that account.


Valid states include:

  • Stopped

  • Start Pending

  • Stop Pending

  • Running

  • Continue Pending

  • Pause Pending

  • Paused

  • Unknown


Name of the computer where the service is installed. This property is useful in scripts that retrieve service status from multiple computers.

The service properties available through Win32_Service are similar to the service properties available through the Services snap-in, as shown in Figure 15.1.

Figure 15.1 Win32_Service Properties