This short code snippet shows how you can start and stop windows services and also how to find the current status of any windows services.
You can use the .NET class System.ServiceProcess.ServiceController to work with the windows services.
Include the namespace in the top of your class:
Create an instance of the class:
ServiceController controller = new ServiceController();
See the following code which gets the status of the IIS Admin service. Also, you can start and stop the service using this class.
controller.MachineName = ".";
controller.ServiceName = "IISADMIN";
string status = controller.Status.ToString();
// Stop the service
// Start the service