PowerShell Find All User Roles

by chart

What is the PowerShell command to find all roles for your user?

PowerShell Find All User Roles Command

Find all roles for your own user with PowerShell

$userRoles = ([adsisearcher]"samaccountname=$env:UserName").FindAll()|select - ExpandProperty properties

$userRoles.memberof | sort

Find all roles for another user with PowerShell

$user = "userNameHere"

$userRoles = ([adsisearcher]"samaccountname=$user").FindAll()|select - ExpandProperty properties

$userRoles.memberof | sort