Created
November 21, 2015 22:09
-
-
Save DWSR/d5bc37e0501145111231 to your computer and use it in GitHub Desktop.
Function to get which distribution groups someone is a member of.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-MemberOfDistributionGroups | |
{ | |
[CmdletBinding()] | |
Param( | |
[String]$Identity | |
) | |
$user = Get-Mailbox $Identity | |
"$($user.DisplayName) is a member of the following groups:" | |
foreach ($Group in (Get-Recipient -Filter "Members -eq '$($user.DistinguishedName)'")) | |
{ | |
" -$($Group.DisplayName)" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment