Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

List of all NT/2000/XP Group Memberships 1

Status
Not open for further replies.

BradB

MIS
Jun 21, 2001
237
US
I would like to grab a list of all the groups that are available on our NT domain. Ideally, I would have a listbox return with all the groups, and I can select them to another listbox.

I believe there's a way to do with with an API, but I'm usnure how to do it.
 
see this faq faq222-31

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
I noticed that post earlier, but I was unsure on how to use it. I'm pretty sure I paste the code into a module, but I what do I do next. How do I use? I need an example.
 
Try this instead:

Option Explicit
Private Type GroupInformation
Name As String
Description As String
End Type
Private GroupInfo() As GroupInformation
Private Const PRIMARY_USER_ACCOUNT_DOMAIN As String = "YourDomain"
Private Sub ListGroups()
Dim objComputer
Dim objGroup
Set objComputer = GetObject("WinNT://" & PRIMARY_USER_ACCOUNT_DOMAIN)
objComputer.Filter = Array("Group")
Dim i As Integer
Dim j As Integer
Dim boolSkipThisRecord As Boolean
For Each objGroup In objComputer
ReDim Preserve GroupInfo(i)
With GroupInfo(i)
.Name = objGroup.Name
.Description = objGroup.Description
End With
i = i + 1
Next
End Sub
Private Sub Command1_Click()
ListGroups
Dim i As Integer
For i = 0 To UBound(GroupInfo)
Combo1.AddItem GroupInfo(i).Name & " - " & GroupInfo(i).Description
Next i
End Sub

"Two strings walk into a bar. The first string says to the bartender: 'Bartender, I'll have a beer. u.5n$x5t?*&4ru!2[sACC~ErJ'. The second string says: 'Pardon my friend, he isn't NULL terminated'."
 
DrJavaJoe, That is EXACTLY what I need. Thanks for the link and the code. You've been very helpful.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top