Obtain the domain name on a workstation or server
Some systems don't have a domain name configured or they might have something in the form of domain.local; yet they are located within a domain.
Is there a 开发者_如何学运维way to get the domain these system belong to?
I already tried using the classic APIs:
NetWkstaGetInfo() DnsQueryConfig()
and many others...
Code is appreciated.
Try GetComputerNameEx()
GetComputerNameEx(ComputerNameDnsDomain, pszBuffer, &dwLength)
getdomainname()
Sorry just noticed the windows tag, see list of network functions
精彩评论