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

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -