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.MachineName = ".";
controller.ServiceName = "MySQL";
string status = controller.Status.ToString();

// Stop the service
controller.Stop();

// Start the service
controller.Start();

Comments

Popular posts from this blog

Get Images Bookmarklet

Opera Fullscreen Autoshow/hide Toolbar

Nomor Telepon PSTN (Pulsa Lokal) Call Center Bank-Bank di Indonesia