Solved

Get Active Directory server from auth machine

Posted on 2009-07-01
3
203 Views
Last Modified: 2013-12-24
Hey, I am developing an app and I need to know the server address for Active Directory, so I can do a connection. So I wanted to know if there is a way to get the IP address of the AD from my "client" machine.

Basically to know to wich server my machine authenticaded to the last time.

Thanks.
0
Comment
Question by:mendezcb
3 Comments
 
LVL 11

Expert Comment

by:Abhay Pujari
ID: 24760751
You can use ipconfig all which will show you your primary DNS server (If you have configured your DC as a DNS as well). OR If you know the name of the server, then try pinging it, will give you IP.
OR open my network places and browse for all computes on your network. You need to browse each machine. The machine which will show you SYSVOL and NETLOGON folders, is your DC. Try pinging it and will get the IP.
0
 
LVL 83

Accepted Solution

by:
oBdA earned 500 total points
ID: 24761054
Well, here's how XP does it:
How Domain Controllers Are Located in Windows XP
http://support.microsoft.com/kb/314861

DsGetDcName Function
http://msdn.microsoft.com/en-us/library/ms675983(VS.85).aspx

Depending on your needs, some easier possibilities might do it:
* check the environment variable %LogonServer%; this has the DC in it that authenticated the user (including two leading backslashes). This server might be down in the meantime.
* resolve the machine's primary domain suffix; this should resolve to a list of DCs of the domain to which the client is joined.
* if the application is run by a domain user, you can resolve the environment variable %UserDNSDomain% as well (no leading backslashes); this variable contains the domain that the user is logged on to (which, in the case of a trust, is not necessarily the same domain as the machine's domain!).
0
 

Author Closing Comment

by:mendezcb
ID: 31599068
Great explaining, and great solution! Is not only about having the answer is about know how to communicate it, you did both great. Thanks.
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
need help with active directory 4 44
ticket bloat 3 27
HP Printer on Windows 2003 Terminal Server 4 34
What's wrong with this T-SQL Foreign Key? 7 44
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question