?
Solved

Get Active Directory server from auth machine

Posted on 2009-07-01
3
Medium Priority
?
211 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 85

Accepted Solution

by:
oBdA earned 2000 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

Back Up Your Microsoft Windows Server®

Back up all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Question has a verified solution.

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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses

765 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