Dim x As System.ServiceProcess.ServiceController
For Each x In ServiceProcess.ServiceController.GetServices()
If x.ServiceName = "MSSQLSERVER" Then
If x.Status <> ServiceProcess.ServiceControllerStatus.Running Then
x.Stop()
MessageBox.Show("Service has Stopped")
Else
x.Start()
MessageBox.Show("Service has started")
End If
End If
Next