ServiceController.DependentServices Property

Gets the set of services that depends on the service associated with this ServiceController instance.

Namespace: System.ServiceProcess
Assembly: System.ServiceProcess (in system.serviceprocess.dll)

property array<ServiceController^>^ DependentServices {
	array<ServiceController^>^ get ();
/** @property */
public ServiceController[] get_DependentServices ()

public function get DependentServices () : ServiceController[]

Property Value

An array of ServiceController instances, each of which is associated with a service that depends on this service.

Exception typeCondition


An error occurred when accessing a system API.

The DependentServices array represents the services that the system stops if your application calls Stop for this service.

The following example uses the ServiceController class to display the set of services that are dependent on the Event Log service.

ServiceController^ sc = gcnew ServiceController(  "Event Log" );
array<ServiceController^>^scServices = nullptr;
if ( sc )
   scServices = sc->DependentServices;

if ( sc && scServices )
   // Display the list of services dependent on the Event Log service.
   if ( scServices->Length == 0 )
      Console::WriteLine(  "There are no services dependent on {0}", sc->ServiceName );
      Console::WriteLine(  "Services dependent on {0}:", sc->ServiceName );
      for each (ServiceController^ scTemp in scServices)
         Console::WriteLine(" {0}", scTemp->DisplayName);

ServiceController sc = new ServiceController("Event Log");
ServiceController scServices[] = sc.get_DependentServices();
// Display the list of services dependent on the Event Log service.
if (scServices.get_Length() == 0) {
    Console.WriteLine("There are no services dependent on {0}",
else {
    Console.WriteLine("Services dependent on {0}:", 
    ServiceController scTemp = new ServiceController();
    for  (int iCtr = 0; iCtr < scServices.get_Length(); iCtr++) {
        scTemp = scServices[iCtr];
        Console.WriteLine(" {0}", scTemp.get_DisplayName());

Windows 98, Windows 2000 SP4, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions