I am trying to pull the list of all users in a specified group. I have been able to query all of the groups like this:
strUsername = Right(strUsername, Len(strUsername) - InStrRev(strUsername, ""))
Set objDomain = GetObject("GC://rootDSE")
objADsPath = objDomain.Get("defaultNamingContext")
Set objDomain = Nothing
Set con = CreateObject("ADODB.Connection")
con.Provider = "ADsDSOObject"
con.Open "Active Directory Provider"
Set com = CreateObject("ADODB.Command")
Set com.ActiveConnection = con
com.CommandText = "SELECT ADsPath, Name FROM 'LDAP://" & objADsPath & "' WHERE objectCategory='group' Order by Name"
Can I just change the query or something? I have searched and nothing seems to be working, but I know it should be easy.
Free Guide: Managing storage for virtual environments
Complete a brief survey to get a complimentary 70-page whitepaper featuring the best methods and solutions for your virtual environment, as well as hypervisor-specific management advice from TechTarget experts. Don’t miss out on this exclusive content!