Solved

Get Active Directory server from auth machine

Posted on 2009-07-01
3
201 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
Comment Utility
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 82

Accepted Solution

by:
oBdA earned 500 total points
Comment Utility
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
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article describes some very basic things about SQL Server filegroups.
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now