Published: 19.May 2021
Categories:

Search for a users in DLs or DDLs in EXO with PowerShell

Search for a users in DLs:

Clear-Host

# Array of users
$users = @('[email protected]','[email protected]')

# Search for a user in DLs
foreach ($user in $users)
{
  Write-Host "`r`nSearching for: $user" -ForegroundColor Cyan
  Get-DistributionGroup -ResultSize Unlimited | `
  Where-Object {(Get-DistributionGroupMember $_.Name -ResultSize Unlimited | foreach {$_.PrimarySmtpAddress}) -contains "$user"}
}

Search for a users in DDLs:

Clear-Host

# Array of users
$users = @('[email protected]','[email protected]')

# Search for a user in DDLs
foreach ($user in $users)
{
  Write-Host "`r`nSearching for: $user" -ForegroundColor Cyan
  Get-DynamicDistributionGroup -ResultSize Unlimited | `
  Where-Object {(Get-Recipient -ResultSize Unlimited -RecipientPreviewFilter $_.RecipientFilter | foreach {$_.PrimarySmtpAddress}) -contains "$user"}
}
5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
PowerAddict.net - Lubomir Goban  ---  Find me on - 
LinkedIn
0
Would love your thoughts, please comment.x
()
x