ServiceController::GetServices Method (String^)


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

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

static array<ServiceController^>^ GetServices(
	String^ machineName


Type: System::String^

The computer from which to retrieve the services.

Return Value

Type: array<System.ServiceProcess::ServiceController^>^

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

Exception Condition

An error occurred when accessing a system API.


The machineName parameter has invalid syntax.

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

.NET Framework
Available since 1.1
Return to top