473,769 Members | 6,120 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB 2005 with Active Directory

How can I enumerate AD objects (only in a given OU, not sub OUs) using the
DirectoryEntry object?

Let me know of this is the wrong forum for this question.

Thanks,
Iain
Aug 31 '06 #1
4 5893
Hi Lain,

Based on my understanding, you want to enumerate the sub objects under
certain OU.

Then, can you be specific about which objects you want to enumerate? I
think the key point is binding to the correct LDAP string(which you can get
the detailed LDAP string with tool such as ADSI Edit), and then you can
enumerate its sub properties. For example, if you want to enumerate the
users in a group, you may refer to the sample listed in the link below:
"Enumeratin g Users in a Group"
http://msdn.microsoft.com/library/de...us/sds/sds/enu
merating_users_ in_a_group.asp

The article below provided a more complex sample about enumerate AD objects
in .Net:
"Enumeratin g Active Directory Objects using C#"
http://www.codeproject.com/dotnet/adtester.asp

You also will find a lot of code samples regarding using
System.Director yServices in sub-nodes of the link below:
http://msdn.microsoft.com/library/de...us/sds/sds/usi
ng_system_direc toryservices.as p

If you need specific help or I have misunderstood you, please feel free to
tell me, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 1 '06 #2
I'm unexperienced in C, but I'll have a look at
http://www.codeproject.com/dotnet/adtester.asp. I got sample code to use the
DirectorySearch object, but that returns all objects in AD, not just the OU
I'm interested in. I'm basically wanting to write my own version of the AD
Users & Computers mmc console.

Thanks for the reply,
Iain

The sample code on the Microsoft website

""Jeffrey Tan[MSFT]"" wrote:
Hi Lain,

Based on my understanding, you want to enumerate the sub objects under
certain OU.

Then, can you be specific about which objects you want to enumerate? I
think the key point is binding to the correct LDAP string(which you can get
the detailed LDAP string with tool such as ADSI Edit), and then you can
enumerate its sub properties. For example, if you want to enumerate the
users in a group, you may refer to the sample listed in the link below:
"Enumeratin g Users in a Group"
http://msdn.microsoft.com/library/de...us/sds/sds/enu
merating_users_ in_a_group.asp

The article below provided a more complex sample about enumerate AD objects
in .Net:
"Enumeratin g Active Directory Objects using C#"
http://www.codeproject.com/dotnet/adtester.asp

You also will find a lot of code samples regarding using
System.Director yServices in sub-nodes of the link below:
http://msdn.microsoft.com/library/de...us/sds/sds/usi
ng_system_direc toryservices.as p

If you need specific help or I have misunderstood you, please feel free to
tell me, thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 1 '06 #3
Hi Lain,

Thanks for your feedback!

Do you mean that you are not familiar with C#? Oh, yes, it is strange that
most of the samples I find are written in C#, not VB.net. However, the
basic idea is the same.

I found one VB.net sample of accessing the user list, for your information:
"Accessing LDAP User list using VB.NET"
http://www.codeproject.com/vb/net/LDAP_Using_VBnet.asp

The best way to translate the C# sample code into VB.net is using
Reflector. *Reflector* is a tool written by Microsoft engineer Lutz Roeder.
It uses .Net Reflection to parse the internal information of the .Net FCL
assemblies. It also decomplies the MSIL code in the FCL into various
languages, such as C#, VB.net, IL etc... It is somewhat like ILdasm.exe in
.Net Framework, but provides higher level language(C#) display. Using it,
you can see the source code of .Net FCL. It is a must have tool for .Net
developer. You may download it for free in the link below:
http://www.aisto.com/roeder/dotnet/

In your scenario, you can use Reflector to open the assemblies generated by
these C# samples. Then you can switch the language from C# to VB.net, then
you can view the sample code in VB.net.

Besides Reflector, you may also some C# to VB.net translators to convert
the sample code. However, these convertion tools are not perfect, you have
to correct the translated VB.net code, I normally use the one below:
http://authors.aspalliance.com/aldot...translate.aspx

Additionally, since you want to write your own version of the AD Users &
Computers mmc console, I found a lot more samples in .Net doing the similar
task, you may refer to their source code as sample:
"Simple Active Directory Browser"
http://www.codeproject.com/dotnet/ac...rybrowser1.asp
"Dynamicall y browse Active Directory Objects"
http://www.codeproject.com/dotnet/Ac...ry_Browser.asp
"Querying Active Directory using .NET classes and LDAP queries"
http://www.codeproject.com/dotnet/activedirquery.asp

Finally, since the .Net DirectoryServic e encapsulates Win32 ADSI
technology, I am sure you will get more useful and professional help in the
microsoft.publi c.adsi.general newsgroup. There are several ADSI programming
experts(MVP) in this newsgroup, and some of them even authored 1 or 2 AD
books. :-)

Hope this helps.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====
This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 1 '06 #4
That's a lot of helpful information you've passed on! I'll look at the URL's
you provided; they look as if they can give me a good start.

Thanks a lot for your help!

Iain
Sep 1 '06 #5

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

Similar topics

0
2785
by: microsoft | last post by:
Hi People, when I try to modify an active directory user programatically, I receive the following exception: The server is unwilling to process the request Reading the microsoft web site, I found this article: http://support.microsoft.com/default.aspx?scid=kb;EN-US;248717 that says the following: ..........................
9
3731
by: Mario Rodriguez | last post by:
Hi people. I have a problem adding users to Win2003 active directory programatically. When I execute my app throws the following exception: .................The specified directory service attribute or value does not exist........... Exactly the same code works fine on my win2000 active directory. My app include the use of the extensionAtributes and I'm not sure if the extensionAttributes feature was removed from win2003 Active...
1
4755
by: Andrew | last post by:
Hey all, Working on revamping our Intranet here and making use of the LDPA, Active Directory, Directory Services, etc. that .Net provides. I am still fairly new on this subject, so the problem I have run into I am not sure how to fix, and really not sure what is causing it. Here's what is going on (test server - Windows 2003 Server): I have a page in a folder (under anonymous authentication in IIS6) that has a link on it that...
6
2417
by: Leo_Surf | last post by:
Hello, I need your help adding user in Active Directory from ASP.net website. Could any one provide me the complete code for the html page. As this is my curriculam project and I dont have any Idea about ASP.net Please Help Thanks in Advance.
0
1708
by: Rich | last post by:
(1) Is there a better place to pose the question below? (2) I am starting to convert my enterprise solution from VS 2003 (.NET v1.1.4322) to VS 2005 Professional (.NET v2.0.50727). The entire solution uses the following technologies - Windows Server 2003 Windows Mobile 2003 Windows XP Professional SP2 Windows 2000 Professional SP4 SQL Server 2000
4
5246
by: Greg P | last post by:
I know this is a long post, please bear with me. I have been working on this all weekend to no avail although I have done a good amount of research (see most pertinent links that I've looked at below). Please help me get through this!!! I'm having some serious problems attaching a .mdf file and accessing it. I have a WroxUntied.mdf that I want to attach and then run the website that uses it. This is a .mdf file from wrox books. ...
7
2758
by: Greg P | last post by:
I know this is a long post, please bear with me. I have been working on this all weekend to no avail although I have done a good amount of research (see most pertinent links that I've looked at below). Please help me get through this!!! I'm having some serious problems attaching a .mdf file and accessing it. I have a WroxUntied.mdf that I want to attach and then run the website that uses it. This is a .mdf file from wrox books. This file...
0
1243
by: David C. Barber | last post by:
I've just built my first Setup-Installable VB 2005 package. I have the full Profession Edition VS 2005, not the Express edition, and am patched to the current SP. It installs on the development machine (Win 2K) and runs just as well as it does in the VS IDE. I used the Walkthrough for Deploying a Windows-based Application in the MSDN files supplied. This application accesses Active Directory in several ways, including using ADODC to...
0
9590
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9424
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10223
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10051
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10000
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3968
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3571
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.