Skip to content

Instantly share code, notes, and snippets.

@DWSR
Created November 21, 2015 22:09
Show Gist options
  • Save DWSR/d5bc37e0501145111231 to your computer and use it in GitHub Desktop.
Save DWSR/d5bc37e0501145111231 to your computer and use it in GitHub Desktop.
Function to get which distribution groups someone is a member of.
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