Sponsored Ad

Tuesday, January 11, 2011

C# Code to Get List of Services Installed on System

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.

C# Code to Get List of Services Installed on System

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

Sponsored Ad

Website Update

Followers