.NET - What is the best library for inspecting and controling Windows Services? [closed]
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed last month.
Improve this questionI need to monitor and control a set of Windows Services that are running either开发者_如何学运维 on a local machine or remotely. I've heard of WMI and ADSI and the first one seems to do what I want. Before going deep into it, I just want to check if I'm going in the right direction?
Thank you
EDIT Additional information: I also need to inspect SQL jobs and IIS instances so I think WMI is what I need.
You might want to look at the ServiceController
class.
http://msdn.microsoft.com/en-us/library/system.serviceprocess.servicecontroller.aspx
This might help for WMI monitoring SQL job events:
http://shellyourexperience.wordpress.com/2011/08/31/monitoring-sql-server-service-with-wmi-events-and-showui/
You could also check Win32_NTLogEvent class:
wmic /namespace:\\root\cimv2 path win32_ntlogevent where SourceName='%SQL%' get /all /format:csv >"%userprofile%\desktop\wmic_win32_ntlogevent.csv"
However I don't think this will list specific SQL jobs. That type of action should be done in SQL itself. ADSI is Active Directory Services Interface, I don't think this what you'll need this however that will depend.
精彩评论