Get Active Directory Group member of a user account.


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.


Function GetGroupMembership {

param ($user)

$UserAllProperties = Get-ADUser $user -Properties *

foreach ($Group in $UserAllProperties.memberof) {Get-ADGroup $Group | select Name }

}

Comments