The Get-ADGroup Member cmdlet gets the members of an proactive book of facts group. The personal identity parameter specifies the Active list building block to access. You can identify a group by its great name (DN), GUID, security identifier (SID), or section Accounts Manager (SAM) account name. You can too specify the group by temporary a group goal through the pipeline.
Sql - TSQL: How to get a list of groups that a user belongs to in ActiveDirectory - Stack Overflow
--; Get all groups in class My Domain quality * from Open Query(ADSI, ' SELECT samaccountname,mail,sn,name, cn, physical object assemblage FROM ''LDAP://Mydomain/CN=users, DC=Mydomain, DC=com'' wherever object Category=''group'' ORDER BY cn ') --; Get all users in domain My Domain pick out * from Open Query(ADSI,' SELECT object Category, cn, sn, mail, name, department,samaccountname FROM ''LDAP://Mydomaindomain/CN=users, DC=Mydomain, DC=com'' WHERE object Category=''user'' order of magnitude BY cn ') -- wherever samaccountname='mylogin' select * from wide-open Query(ADSI, 'SELECT goal Category, cn, sn, mail, name, administrative district FROM ''LDAP://Mydomain/CN=users, DC=wl-domain, DC=com'' wherever component Of=''cn=_____GROUPNAME_____, CN=users, DC=Mydomain, DC=com'' status BY cn' ) for the user) that have national leader than one value in them. You can retrieve single-valued attributes look-alike "sn" (surname = last name) or "given Name" and "mail" and so forth, but the SQL-based interface isn't capable of manual labour attributes like "member Of" with respective measure assigned to them. So I'm aghast you'll have to go another way for this job - e.g.