I often find myself running the following PowerShell command to figure out a user’s AD group membership:
Get-ADUser <username> -Properties MemberOf | Select -Expand MemberOf
I’ve written a little helper function that lives in my PowerShell profile (at the moment to replace this with the following syntax:
Get-ADUserGroupMembership <username>
Here’s the (very simple) code for the function. No error handling, mind you, but it saves me a bit of typing each time.
function Get-ADUserGroupMembership { Param ( [parameter(Mandatory=$true)] [string]$Username ) Get-ADUser $username -Properties MemberOf | Select -Expand MemberOf }