Enumerating Dependent and Antecedent Services

Microsoft® Windows® 2000 Scripting Guide

Service management is complicated by service dependencies. For example, many Internet services - including the FTP Publishing Service, the World Wide Web Publishing Service, and the Simple Mail Transfer Protocol (SMTP) Service - are dependent upon the Internet Information Services (IIS) Admin Service. If the IIS Admin Service is not available, none of these dependent services can run.

Conversely, you cannot stop the IIS Admin Service without first stopping the dependent services. If this were allowed, stopping the IIS Admin Service would cause all its dependent services to fail because those services cannot run unless IIS Admin Service is also running. The IIS Admin Service is therefore antecedent to its dependent services.

The relationship between the dependent and antecedent roles is as follows:

  • Antecedent. If Service X is antecedent to Service Y, Service X must be running before you can run Service Y.

  • Dependent. If Service X is dependent on Service Y, Service Y must be running before you can run Service X.

Figure 15.3 maps these service roles to the Dependencies property page found in the Services snap-in.

Figure 15.3 Dependent and Antecedent Roles

sas_ser_03s

To determine service dependencies, you need a script that specifies the service to be enumerated and its role. The Win32_DependentService class provides a means to identify the particular role played by that service.

note Note

  • Win32_DependentServices is an association class, a special type of class that specifies a relationship between two WMI objects. For more information about Association classes, see "WMI Scripting Primer" in this book.

For example, to list all the services that depend on the Remote Access Connection Manager, you need to create a script that:

  1. Retrieves all services associated with the Remote Access Connection Manager.

  2. Filters the list so it displays only those associated services for which the Remote Access Connection Manager is the antecedent.