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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Getting a list of all groups in domain using iadsGroup

Status
Not open for further replies.

slames

Technical User
Nov 5, 2002
211
GB
Hi, I am trying to determine with the use of Visual Basic 6.0 a list of all groups in the domain. I have been able to use isMember to get a boolean answer to determine if a user is in a group, but am unable to figure out how to get a list of all existing groups.
Can anyone help?

Thanks

Steph
 
Here's a Windows Management Instrumentation (WMI) solution:
Code:
Dim strComputer As String
    Dim objWMIService As Object
    Dim colItems As Object
    Dim objItem As Object
    
    On Error Resume Next
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    Set colItems = objWMIService.ExecQuery("Select * from Win32_Group", , 48)
    For Each objItem In colItems
        List1.AddItem objItem.Name
    Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top