开发者

Detecting connection to a domain

I'm trying to detect either by calling an API or using WMI whether a computer is connected to a domain.

I am currently reading the env. variable USERDOMAIN to check whether I 开发者_运维技巧am connected to a domain or not but that only works for domains that I know. Is there a better way to see whether I am connected to a LAN/domain?

The code is in C, for windows XP or 7.

thank you.


Try NetGetJoinInformation. It can give you four results.

NetSetupUnknownStatus  The status is unknown.
NetSetupUnjoined       The computer is not joined.
NetSetupWorkgroupName  The computer is joined to a workgroup.
NetSetupDomainName     The computer is joined to a domain.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜