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.
"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.
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'."
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.