We occasionally need to make a note of the groups a user is a member of. If they’re going on maternity leave, for example.
This script does require the Active Directory Module For Windows PowerShell.
$user = "username"
Get-ADPrincipalGroupMembership $user | select name