Find servers using Active Directory
is it possible to query Active Directory for servers?
In detail I want to retrieve information about instances of SQL Server / Sharepoint / IIS / and AnalysisServices servers of a domain using C#.
Which attributes do I have to check in order to find out which service is running on a machine?
If it is not possible to get this infor开发者_Python百科mation from Active Directory, any other ideas are welcome.
Here's a CodeProject article which creates and demonstrates a general-purpose network server enumerator - you can pick what type of server(s) you're interested in, and have a list of server matching that criteria enumerated from your network. It uses routines from the netapi32.dll and surfaces them in a nice, C# compatible way.
Pretty slick stuff!
In AD, of course, you could also enumerate the servers based on the ObjectCategory - but I'm not sure if and how you could distinguish them into separate roles (SQL server, DC etc.).
Another CodeProject article shows how to enumerate objects in general in AD - you can definitely enumerate the computers (objectCategory=computer
) from AD, but I'm not sure you can limit what you'll get back ahead of time with an LDAP filter...
精彩评论