DirectoryServices - where are the OrganizationalUnits and SBS contacts?

B

BDRR82

This code works, but I'm totally new to Active Directory, so the code didn't
do what I expected/wanted.

What I want is to walk the Active Directory on a Small Business Server 2000
box, writing out each Organizational-Unit, User, Group, Distribution List,
and Contact.

Of course I can see with eyeballs all the Organizational-Units, Users,
Groups, Distribution Lists, and Contacts using the SBS2000 Administration
Console app.

And the Code below does get 2 of the 5 categories I need: it gets Users and
Groups.

But can anyone clue me in, point to sample code, etc, on how to get
DirectoryServices (or some other facility?) to cough up the
Organizational-Units, Distribution Lists, and Contacts?

thanks!

Dim sPath As String = "WinNT://SMALLBUSINESS.local"
FileOpen(3, "C:\enum.txt", OpenMode.Output)
Dim deDomain As DirectoryEntry = New DirectoryEntry(sPath,
"SMALLBUSINESS\Administrator", "NoShowInPost")
Dim deThings As DirectoryEntries = deDomain.Children

PrintLine(3, "Things-----")
For Each deThing As DirectoryEntry In deThings
PrintLine(3, deThing.Name & ", " & deThing.SchemaClassName)
PrintLine(3, " Children-----")
Dim deThingChildren As DirectoryEntries = deThing.Children
For Each deThingChild As DirectoryEntry In deThingChildren
PrintLine(3, " " & deThingChild.Name & ", " &
deThingChild.SchemaClassName)
Next deThingChild
Next deThing
FileClose(3)

---- end post ----
 
W

Willy Denoyette [MVP]

BDRR82 said:
This code works, but I'm totally new to Active Directory, so the code
didn't
do what I expected/wanted.

What I want is to walk the Active Directory on a Small Business Server
2000
box, writing out each Organizational-Unit, User, Group, Distribution List,
and Contact.

You should use the LDAP provider, don't use WinNT as provider, this one is
for downlevel domains not for Active Directory domains.

WIlly.
 
M

Marc Scheuner [MVP ADSI]

But can anyone clue me in, point to sample code, etc, on how to get
DirectoryServices (or some other facility?) to cough up the
Organizational-Units, Distribution Lists, and Contacts?

You could have a look at my open-source, freeware C# ADSI Browser
called "BeaverTail" here:

http://adsi.mvps.org/adsi/CSharp/beavertail.html

You can download the app and the full C# source from that page. Shows
you how to use some of System.DirectoryServices features in your own
app.

Marc

================================================================
Marc Scheuner May The Source Be With You!
Bern, Switzerland m.scheuner(at)inova.ch
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top