473,412 Members | 4,519 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,412 software developers and data experts.

DirectoryEntry AD query problem.

In VB.Net I'm trying to find out the names of what Administrative Groups
exist by querying Active Directory. The problem is when I try and query the
children of the key LDAP://CN=Administrative Groups, CN=ExchOrg,
CN=Microsoft Exchange, CN=Services, CN=Configuration, CN=domain, CN=com I
don't get anything except an error that the "Object doesn't exist on the
server." However when I bind to this LDAP path using LDP.exe I can see the
Administrative Group Names underneath the tree just fine and even drill in
to them.

Here's my code:

Dim TempDE As New DirectoryEntry("LDAP://CN=Administrative Groups,
CN=ExchOrg, CN=Microsoft Exchange, CN=Services, CN=Configuration, CN=domain,
CN=com")
Dim prop As DirectoryEntry
Dim propnm As String = String.Empty
Dim strv As String
Dim objv As Object

MessageBox.Show(TempDE.Name.ToString)
For Each prop In TempDE.Children
For Each strv In prop.Properties.PropertyNames
For Each objv In prop.Properties(strv)
propnm += strv & " : " & objv.ToString & vbCrLf
Next
Next
Next

If I change the LDAP path to LDAP://CN=Microsoft Exchange, CN=Services,
CN=Configuration, CN=domain, CN=com the code above works fine.
May 14 '07 #1
1 4948
Well I figured it out and wanted to post so it may help others. The problem
was with permissions. Using the DirectoryEntry.Username and
DirectoryEntry.Password to pass enterprise admin credentials resolved the
issue.

"Magnus R" <ro******@hotmail.comwrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
In VB.Net I'm trying to find out the names of what Administrative Groups
exist by querying Active Directory. The problem is when I try and query
the
children of the key LDAP://CN=Administrative Groups, CN=ExchOrg,
CN=Microsoft Exchange, CN=Services, CN=Configuration, CN=domain, CN=com I
don't get anything except an error that the "Object doesn't exist on the
server." However when I bind to this LDAP path using LDP.exe I can see the
Administrative Group Names underneath the tree just fine and even drill in
to them.

Here's my code:

Dim TempDE As New DirectoryEntry("LDAP://CN=Administrative Groups,
CN=ExchOrg, CN=Microsoft Exchange, CN=Services, CN=Configuration,
CN=domain,
CN=com")
Dim prop As DirectoryEntry
Dim propnm As String = String.Empty
Dim strv As String
Dim objv As Object

MessageBox.Show(TempDE.Name.ToString)
For Each prop In TempDE.Children
For Each strv In prop.Properties.PropertyNames
For Each objv In prop.Properties(strv)
propnm += strv & " : " & objv.ToString & vbCrLf
Next
Next
Next

If I change the LDAP path to LDAP://CN=Microsoft Exchange, CN=Services,
CN=Configuration, CN=domain, CN=com the code above works fine.


May 17 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Sezgin Rafed | last post by:
Hi everyone, I need to select Users from 2 Domains - one the User has logged into and a second one, which is a trusted Domain. There is no problem selecting Users from the Domain the User has...
0
by: ABSMunkee | last post by:
I have a vb.net dll that has two functions: one allows a user to change their password in AD, the second allows the user to view their distinguishedname (based on their samaccountname). Both bind...
0
by: Querton Pierre-Benoit | last post by:
Hello, I develop a class to control IIS throw ADSI. But is seems that some method doesn't work with IIS. To be more clear ;) When I do the following code : DirectoryEntry w3svc = new...
2
by: Jessica | last post by:
When I create a single LDAP ActiveDirectory user and use DirectoryEntry.Invoke("SetPassword"...), the user is created and the password is set with no problems. However, when I try to add more...
2
by: Jay | last post by:
Please excuse the double post if your reader shows this as a new and as a reply. I can only use the web interface and it puts my reply 34 pages in. I am getting an error while trying to do a...
2
by: AbdSol | last post by:
I wanted to know why the output is different & also like to know if C# i can get the user name using DirectoryEntry > find. C# String myADSPath = ("WinNT://"+...
1
by: kenguil | last post by:
I'm hoping that this is the right group to post this to and that someone will have an answer to this. Environment: 1) Laptop joined to domain "foo.com", logged in using cached credentials 2)...
1
by: Joanne | last post by:
I'm wondering if anyone has come across this problem before - it's got me stumped (but then again, I don't know a great deal about AD!!) In a specific set of circumstances, we get a really useful...
5
by: Michael Howes | last post by:
I'm writing a utility to manage a machines *local* accounts in c# I am getting all the users in a specific Group just fine but when I want to get some of the information on each user from their...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.