ServiceController.GetServices Method ()

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Retrieves all the services on the local computer, except for the device driver services.

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

static member GetServices : unit -> ServiceController[]

Return Value

Type: System.ServiceProcess.ServiceController[]

An array of type ServiceController in which each element is associated with a service on the local computer.

Exception Condition
Win32Exception

An error occurred when accessing a system API.

GetServices returns only the non-device driver services and the services that are not drivers from the local computer. To retrieve device driver services, call the GetDevices method. Together, the two methods provide access to all the services on a computer.

The following example uses the ServiceController class to display the services that are running on the local computer.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 1.1
Return to top
Show: