Use the snippet below to get a list of all AD groups that a certain username is member of. Replace “[username]” with the correct username. Execute this command in a new Powershell window.
Get groups of user
Get-ADPrincipalGroupMembership [username] | select nameYou should get the following response:
PS C:\Windows\system32> Get-ADPrincipalGroupMembership svc_myapp | select name
name
----
Domain Users
Service_accountsGet users in a group
This command fetches all AD users in a group and returns their first and last name.
Get-ADGroupMember -Identity "[group-name-here]" | Get-ADUser -Property GivenName, SurName | Select-Object GivenName,SurNameIt should return this response:
PS C:\Windows\system32> Get-ADGroupMember -Identity "Domain Admins" | Get-ADUser -Property GivenName, SurName | Select-Object GivenName,SurName
GivenName SurName
--------- -------
John Doe
Pete PetersonGood luck!

