How to list all installed windows services in C# and VB.NET

To list installed services in C# and VB.NET you can use the following snippet.

Sample C#

public static void ListInstalledServices()
{
	var services = ServiceController.GetServices();
	foreach (var service in services)
	{
		Console.WriteLine(@"Installed: {0}", service.ServiceName);
	}
}

Sample VB.NET

Public Shared Sub ListInstalledServices()
	Dim services = ServiceController.GetServices()
	For Each service As var In services
		Console.WriteLine("Installed: {0}", service.ServiceName)
	Next
End Sub

Please Share us:
Please rate this snippet

One thought on “How to list all installed windows services in C# and VB.NET

Leave a Reply