ServiceController service = new ServiceController("MyServiceName");
if ((service.Status.Equals(ServiceControllerStatus.Stopped)) ||
(service.Status.Equals(ServiceControllerStatus.StopPending)))
service.Start();
else service.Stop();
its working on xp 32 bit but not working on win 7.ti throws a exception access denied. is there any solution to this.plz help me.