1

I'm working on a project that is composed of a few windows services that collect data and persist them into a database. Now I have to develop an administration panel (a windows application) that can show the statuses of windows services to user. I found out how to verify if a windows service is running using C#: How can I verify if a Windows Service is running

But my problem is: my windows services are running on a server and the user will run the administration panel on his/her computer. Is it possible to detect the status of a windows service from another computer. If yes, how?

Community
  • 1
  • 1
xkcd
  • 2,538
  • 11
  • 59
  • 96

3 Answers3

4

You can do this with WMI, this example works for me (Obviously comment out the Stop part)

Alex K.
  • 171,639
  • 30
  • 264
  • 288
  • Thanks Alex. It seems good, but there is a point that I didn't understand. ManagementScope scope = new ManagementScope(@"\\" + ipAddress + @"\root\cimv2"); In that line do I have to change the @"\root\cimv2" part? – xkcd Sep 05 '11 at 13:14
  • No, you just change the `ipAddress` to that of the machine running the services you wish to examine – Alex K. Sep 05 '11 at 13:16
0

Not a C# developer, but logically speaking, I would make a small background application which checks these services on the server, and then I talk to this application and request the status of any of my services.

mohdajami
  • 9,604
  • 3
  • 32
  • 53
0

You can use the pslist command: It gives you information about the running processes on a remote computer, however you have to provide credentials to access the other computer...

http://technet.microsoft.com/en-us/sysinternals/bb896682

Tobias Schittkowski
  • 2,221
  • 2
  • 16
  • 25