AD-X icon indicating copy to clipboard operation
AD-X copied to clipboard

Automatically attempt to detect domain server for Windows

Open robertrossmann opened this issue 11 years ago • 1 comments

When running php scripts on a Windows machine that is joined to a domain, there are some environment variables which could tell me the DNS name of the domain the computer is joined to. That way, users would not have to know the exact server address, just call Link::connect()->bind('user', 'pass'); and be done with it.

robertrossmann avatar Apr 29 '13 21:04 robertrossmann

There are two environment variables I found that reference the domain that a computer is joined to. For the typical example of the "contoso.com" domain: USERDNSDOMAIN = CONTOSO.COM USERDOMAIN = CONTOSO

You can then query DNS for "contoso.com" and it will return the IPs of the domain controllers, though some of them may be in different AD sites if the network is separated over WAN links.

BentSpacetime avatar Jan 13 '16 05:01 BentSpacetime