c# - How to find out windows service status which is running on another server from one server? -
normally when required know 1 of service status in existing server means easy finding result servicecontroller pasted below code:
servicecontroller sc = new servicecontroller("servicename"); if ((sc.status.equals(servicecontrollerstatus.stopped)) || (sc.status.equals(servicecontrollerstatus.stoppending))) { // start service if current status stopped. sc.start(); }
here know service status of machine, how can find out result can 1 able guide me on scenario.
there's constructor of servicecontroller takes machine name second parameter. http://msdn.microsoft.com/en-us/library/ssbk2tf3.aspx
have tried it?
Comments
Post a Comment