Discussion:
Ridiculous problem
(too old to reply)
j***@gmail.com
2005-12-14 00:19:20 UTC
Permalink
Ok, I've rarely been driven this insane by a seemingly simple problem.
I'm trying to query the highestCommittedUSN in rootDSE. Seemingly
simple enough I'm using this code:

DirectorySearcher searcher = new DirectorySearcher();
searcher.SearchRoot= new DirectoryEntry("LDAP://rootDSE");
SearchResultCollection results;
results = searcher.FindAll();

...and I'm getting the following error

"The provider does not support searching and cannot search
LDAP://rootDSE"

Now, I've also tried a different SearchRoot 'format'.....
searcher.SearchRoot= new DirectoryEntry("LDAP://domain.com/rootDSE");

and using FindOne().....
SearchResult results;
results = searcher.FindOne();

and different authentication...
searcher.SearchRoot= new
DirectoryEntry("LDAP://rootDSE","Administrator","word123",AuthenticationTypes.Secure);


The code has been documented many times in other threads and it SEEMS
as though this should work.

I've no problem searching for any other DN, container, user, computer,
or otherwise.

OS: Windows2000 Advanced Server SP3
.NET: 1.1
VS.NET 2003
Joe Kaplan (MVP - ADSI)
2005-12-14 05:49:01 UTC
Permalink
Any reason why you have to use the searcher? The attribute is just a string
and is easy to marshal with the DirectoryEntry:

DirectoryEntry entry = new DirectoryEntry("LDAP://localhost/rootDSE");
Console.WriteLine("highest committed usn: {0}", (string)
entry.Properties["highestCommittedUSN"].Value);

That worked fine on my local ADAM instance.

I'm not actually sure if ADSI will let you build a DirectorySearcher against
RootDSE, but you shouldn't need to.

Joe K.
Post by j***@gmail.com
Ok, I've rarely been driven this insane by a seemingly simple problem.
I'm trying to query the highestCommittedUSN in rootDSE. Seemingly
DirectorySearcher searcher = new DirectorySearcher();
searcher.SearchRoot= new DirectoryEntry("LDAP://rootDSE");
SearchResultCollection results;
results = searcher.FindAll();
...and I'm getting the following error
"The provider does not support searching and cannot search
LDAP://rootDSE"
Now, I've also tried a different SearchRoot 'format'.....
searcher.SearchRoot= new DirectoryEntry("LDAP://domain.com/rootDSE");
and using FindOne().....
SearchResult results;
results = searcher.FindOne();
and different authentication...
searcher.SearchRoot= new
DirectoryEntry("LDAP://rootDSE","Administrator","word123",AuthenticationTypes.Secure);
The code has been documented many times in other threads and it SEEMS
as though this should work.
I've no problem searching for any other DN, container, user, computer,
or otherwise.
OS: Windows2000 Advanced Server SP3
.NET: 1.1
VS.NET 2003
j***@gmail.com
2005-12-14 14:00:23 UTC
Permalink
Feeling pretty silly now. I guess once one gets in a mindset, it hard
to get perspective.

Thanks,
Q.M.
Joe Kaplan (MVP - ADSI)
2005-12-14 16:08:41 UTC
Permalink
This post might be inappropriate. Click to display it.
Stefan
2006-01-31 14:58:28 UTC
Permalink
The DirectorySearcher works also without specifying the root.
You can retrieve objects and attributes with the entire domain
as search scope.
(I get the same exception using LDAP://RootDSE).
Post by j***@gmail.com
Feeling pretty silly now. I guess once one gets in a mindset, it hard
to get perspective.
Thanks,
Q.M.
Marc Scheuner [MVP ADSI]
2005-12-14 06:34:26 UTC
Permalink
Post by j***@gmail.com
Ok, I've rarely been driven this insane by a seemingly simple problem.
I'm trying to query the highestCommittedUSN in rootDSE. Seemingly
DirectorySearcher searcher = new DirectorySearcher();
searcher.SearchRoot= new DirectoryEntry("LDAP://rootDSE");
SearchResultCollection results;
results = searcher.FindAll();
...and I'm getting the following error
"The provider does not support searching and cannot search
LDAP://rootDSE"
If you want to read a property from the RootDSE entry, why are you
trying to search on it??

You should just bind to the RootDSE entry and then read the property:


DirectoryEntry deRoot = new
DirectoryEntry("LDAP://domain.com/rootDSE");

object oHighest = deRoot.Properties["highestCommittedUSN"].Value;



That should do the trick!
Marc
Loading...