How to detect if machine is joined to domain?

后端 未结 12 1991
梦毁少年i
梦毁少年i 2020-11-28 08:59

How do I detect whether the machine is joined to an Active Directory domain (versus in Workgroup mode)?

12条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-11-28 09:48

    The proposed solution above returns false on a domain machine if a local user is logged in.

    The most reliable method i have found is via WMI:

    http://msdn.microsoft.com/en-us/library/aa394102(v=vs.85).aspx (see domainrole)

提交回复
热议问题