473,386 Members | 1,908 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How to get current domain components for LDAP query?

Seth Schrock
2,965 Expert 2GB
I've got a function that gets a list of all the users in a specified Active Directory group via an LDAP query. Part of the query string is the domain components. For example, if my domain is Test.com, then the part of the query string in question would be
Expand|Select|Wrap|Line Numbers
  1. "<LDAP://DC=Test,DC=com>"
I would like to automate this so that I don't have to hard code these components. I have found an API that gets the "Test" portion (link), but I can't find anything for the ".com" portion.
Jul 29 '15 #1

✓ answered by Rabbit

Expand|Select|Wrap|Line Numbers
  1. Set objRoot = GetObject("LDAP://RootDSE")
  2. strDomain = objRoot.Get("DefaultNamingContext")

4 2566
Rabbit
12,516 Expert Mod 8TB
Expand|Select|Wrap|Line Numbers
  1. Set objRoot = GetObject("LDAP://RootDSE")
  2. strDomain = objRoot.Get("DefaultNamingContext")
Jul 29 '15 #2
Seth Schrock
2,965 Expert 2GB
Awsome! That is exactly what I was looking for. Thanks Rabbit!
Jul 29 '15 #3
Rabbit
12,516 Expert Mod 8TB
No problem!
Jul 29 '15 #4
NeoPa
32,556 Expert Mod 16PB
I use the following, which was recommended as the basic standard. Unfortunately, I have no idea where it came from originally.
Expand|Select|Wrap|Line Numbers
  1.         strDN = "LDAP://OU=MyBusiness," & _
  2.                 GetObject("LDAP://RootDSE").Get("rootDomainNamingContext")
It can't hurt to have multiple approaches to choose from.
Jul 30 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Kmart | last post by:
Hi all I've been looking around google and the net searching for a way to sort the result of an LDAP-query without any luck. Is it possible to do this or do I have to make my own sorting routine...
2
by: Robert Bryan via .NET 247 | last post by:
Hello, Is there any way to determine which server answers an LDAP query? One that is not directed at a particular server that is. ie. DirectoryEntry oUser=new...
1
by: dln | last post by:
Hello all. I'm trying to find the right group to post this to and since it's a coding question (of sorts), hopefully this is the right place. I'm attempting to run an LDAP query to return the...
1
by: Dave | last post by:
Could someone fix this for me please. The last bit i cant figure out is the last line in the sub. Results.SetDataBinding(myTable.DefaultView, "") Thanks Dave ...
3
by: maria.s | last post by:
Hi, I've got a problem with an LDAP query submitted from my ASP.NET application. Configuration: Windows 2003 Server Standard Ed., the application uses Windows Integrated Authentication and is...
2
by: HamishC | last post by:
Hi all, I have been knocking my head against this one for a few days -- haven't been able to find a solution to this anywhere so hopefully someone can help. Situation: A really simple LDAP that...
7
by: MrHelpMe | last post by:
Sorry everyone, NOTE: I have posted this question to another site but unfortunately, am not getting the answers I need only because those helping haven't worked with ASP. I am in desperate...
1
by: tvnaidu | last post by:
any software to download certificates automatically for domain control / LDAP / OCSP? (for authentication purpose)
1
by: fatmitch | last post by:
Hi, I have just installed a 2003 DC to our 2000 Domain and the only problem i'm getting is from our intranet server, the ASP script which authenticates users with AD is getting the following error...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.