This Sample code will help you to list down all the services installed on your system. Note that you have to add an dll library “System.ServiceProcess” in project references.
Source Code to Get all Service list:
using System;
using System.ServiceProcess;
namespace ConsoleApp
{
class Program
{
static void Main(string[] args)
{
ServiceController[] service_list = ServiceController.GetServices();
foreach (ServiceController my_service in service_list)
{
Console.WriteLine(my_service.ServiceName);
}
Console.ReadLine();
}
}
}
0 comments:
Post a Comment