another solution:
Get group distinguishedname:
SELECT name,distinguishedname
FROM OPENQUERY( ADSI,
'SELECT Name, distinguishedname
FROM ''LDAP://xxxxxxx/DC=xxxx,DC=COM,DC=BR''
WHERE objectCategory = ''GROUP'' and CN = ''*FILTER*''')
order by name
Get group membership:
SELECT samaccountname,Name
FROM OPENQUERY( ADSI,...