Programmatically Start/Stop Windows Service
Source: http://www.dotnetspider.com/resources/865-How-start-stop-windows-services-programmati.aspx
[C#]
using System.ServiceProcess; // add .Net Reference to Project
ServiceController controller = new ServiceController();
controller.ServiceName = "MySQL";
string status = controller.Status.ToString();
// Stop the service
controller.Stop();
// Start the service
controller.Start();
Comments
Post a Comment