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

后端 未结 7 629
情话喂你
情话喂你 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:31

    Straight from Microsoft:

    How To Determine If a Windows NT/Windows 2000 Computer Is a Domain Member

    This approach uses the Windows API. From the article summary:

    This article describes how to determine if a computer that is running Windows NT 4.0 or Windows 2000 is a member of a domain, is a member of a workgroup, or is a stand-alone computer using the Local Security Authority APIs.

    The article also provides sample code for a small program that outputs whether the computer the program is running on is part of a domain, part of a workgroup, or a standalone computer.

提交回复
热议问题