Solved

Get Active Directory server from auth machine

Posted on 2009-07-01
3
205 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 84

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Many companies are looking to get out of the datacenter business and to services like Microsoft Azure to provide Infrastructure as a Service (IaaS) solutions for legacy client server workloads, rather than continuing to make capital investments in h…
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
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…

733 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