How do you programmatically determine whether a Windows computer is a member of a domain?

后端 未结 7 614
情话喂你
情话喂你 2020-12-31 09:43

I need a way to determine whether the computer running my program is joined to any domain. It doesn\'t matter what specific domain it is part of, just whether it is connecte

7条回答
  •  有刺的猬
    2020-12-31 10:17

    I think the NetServerEnum function will help you in what you want; I would ask for the primary domain controllers with the SV_TYPE_DOMAIN_CTRL constant for servertype parameter. If you don't get any, then you're not in a domain.

提交回复
热议问题