473,385 Members | 1,325 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,385 software developers and data experts.

ENUMERATE DOMAIN USERS

Hi! I have a function that returns a System.Collections.Generic.List(Of
String) of the users in a specified group.

It seems to work fine with an exception of the Domain Users group. When I
query Domain Users I only get a few users back even if it is several
thousand members in this group.

The code I use is:
Sub GetGroupMembers(ByVal ggmGroup As String, ByRef ggmMembers As
System.Collections.Generic.List(Of String))
Try
Dim entry As DirectoryEntry = New DirectoryEntry(ggmGroup)
Dim searcher As DirectorySearcher = New DirectorySearcher(entry)
searcher.Filter = "(objectClass=*)"
Dim rangeStep As System.UInt32 = 1000
Dim rangeLow As System.UInt32 = 0
Dim rangeHigh As System.UInt32 = CUInt(rangeLow + (rangeStep -
1))
Dim lastQuery As Boolean = False
Dim quitLoop As Boolean = False
Do
Dim attributeWithRange As String
If Not lastQuery Then
attributeWithRange =
String.Format("member;range={0}-{1}", rangeLow, rangeHigh)
Else
attributeWithRange = String.Format("member;range={0}-*",
rangeLow)
quitLoop = True
End If
searcher.PropertiesToLoad.Clear()
searcher.PropertiesToLoad.Add(attributeWithRange)
Dim results As SearchResult = searcher.FindOne
For Each res As String In results.Properties.PropertyNames
System.Diagnostics.Debug.WriteLine(res.ToString)
Next
If results.Properties.Contains(attributeWithRange) Then
For Each obj As Object In
results.Properties(attributeWithRange)
If obj.GetType.Equals(GetType(System.String)) Then
Else
If obj.GetType.Equals(GetType(System.Int32))
Then
End If
End If
ggmMembers.Add(obj.ToString)
Next
Else
lastQuery = True
End If
If Not lastQuery Then
rangeLow = CUInt(rangeHigh + 1)
rangeHigh = CUInt(rangeLow + (rangeStep - 1))
End If
attributeWithRange = Nothing
results = Nothing
Loop While Not quitLoop

entry = Nothing
searcher = Nothing
rangeStep = Nothing
rangeLow = Nothing
rangeHigh = Nothing
lastQuery = Nothing
quitLoop = Nothing
Catch ex As Exception
logfile.WriteLine("Error! Could not connect to group " &
ggmGroup & ". - " & ex.ToString)
End Try
End Sub
Can anyone tell me what is wrong?

Regads

Morten Fagermoen

Oct 20 '06 #1
0 1041

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

Similar topics

27
by: Tim Tyler | last post by:
Are there many PHP public domain projects out there? I'm particularly interested in CMS project materials. So far - outside of my own projects - I've found /very/ little PD PHP material out...
5
by: Jeff Grundy | last post by:
How do I enumerate the machines domain, then enumerate the shares of a machine?
0
by: RobinB | last post by:
We gave created a web application that uses AD for authorization and authentication. The application can be used by domain users as well as the general public. What we currently have is 2 domains...
0
by: news | last post by:
I have one Active Directory Group that contains users and groups objects. I need recursively call my function to get all users that are in the group and subgroups. All is working fine, when i...
1
by: Mad Scientist Jr | last post by:
I would like to write a vb.asp.net function Private Function fn_sGetRoles(byval sDelimiter as string) As String that simply returns a delimited list of all the roles a user belongs to. I...
23
by: BH Jodo Kast | last post by:
Hi, I found this handy script and I'm trying to convert it to VB.NET. It pops up a list of members in the Administrators/Builtin group. Can't seem to get DirectorySearcher or DirectoryEntry...
0
by: bcanter | last post by:
I found a file on the web that will allow you to enumerate groups but it was an .hta and the top level admins won't allow this. I need to give managers access to the groups so that when a new user is...
2
by: =?Utf-8?B?am1hZ2FyYW0=?= | last post by:
I'm trying to get a list of user accounts on the local computer - the same list you see when you are about to log in to Windows XP or Vista. This needs to work on a home computer (not connected to...
0
by: PRR | last post by:
Here is a code i found on "how to enumerate appdomains in a current process". The original code was posted by Thomas Scheidegger Add the following as a COM reference -...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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...

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.