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.