开发者

API for Detecting Windows Active Directory name/IP

I have a requirement to detect all users from local and Active Directory(if present) in Windows.

I have found that C API: NetQueryDisplayInformation() has also the option to retrieve the information from a "serverName", which is开发者_如何学运维 presumably an Active Directory which can be queried.

But how do I find out if ActiveDirectory is available/ and it's name ? Thanks.


This information is available in WMI. In the Win32_ComputerSystem class (there will be a single instance per computer) has a Domain property containing the domain's name.


Another way of finding out domain name (if present) is to use WIN API ::DsGetDcName() This one returns information about Active Dir server name in DOMAIN_CONTROLLER_INFO struct. You get there all the domain information you need. Much sympler than using WMI :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜