Below is a program that will return all installed Windows Services on a local machine. The program uses the namespace System.ServiceProcess, which can be used by adding the Assemblies System.ServiceProcess.dll

 static void Main(string[] args)
        {

            System.ServiceProcess.ServiceController[] services = System.ServiceProcess.ServiceController.GetServices();

            foreach (System.ServiceProcess.ServiceController service in services)
            {
                Console.WriteLine(service.ServiceName);
            }
            Console.ReadKey();
        }

Happy Coding!

More C# Snippets

Last modified: May 19, 2019

Comments

Write a Reply or Comment

Your email address will not be published.