Retrieving Service Properties

Microsoft® Windows® 2000 Scripting Guide

microsoft windows 2000 scripting guide

« Previous | Next »   

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

PropertyDescription
AcceptPauseIndicates whether the service can be paused.
AcceptStopIndicates whether the service can be stopped.
DescriptionDescription of the service.
DesktopInteractIndicates 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.
DisplayNameName 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.
ErrorControlAction 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.
ExitCodeError 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).
NameUnique name of the service as stored in the registry.
PathNameFully qualified path to the executable file responsible for implementing the service.
ProcessIDProcess identifier assigned to the service during startup.
ServiceTypeValid service types include:
  • Kernel Driver
  • File System Driver
  • Adapter
  • Recognizer Driver
  • Own Process
  • Win32 Share Process
  • Interactive Process
StartedIndicates whether or not the service is started.
StartModeValues 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.
StartNameAccount 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.
StateValid states include:
  • Stopped
  • Start Pending
  • Stop Pending
  • Running
  • Continue Pending
  • Pause Pending
  • Paused
  • Unknown
SystemNameName 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

Win32_Service Properties


send us your feedback Send us your feedback « Previous | Next »   


Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 635

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net