We will use the active directory PowerShell shell to fetch the users Group membership, so make sure you import the active directory module before you run the below script.
Below the script code that can be used to fetch the user group membership.
POWERSHELL
Function GetGroupMembership {
param ($user)
$UserAllProperties = Get-ADUser $user -Properties *
foreach ($Group in $UserAllProperties.memberof) {Get-ADGroup $Group | select Name }
}
💬 Reader Comments & Feedback
Did this runbook help, or did Microsoft change a cmdlet or UI menu? Share your feedback below.
Leave a Comment or Report an Update