Share via


PowerShelll: Get-MailBox Emailaddresses Filter Required Domain


Requirement

Need a report which should contain user DisplayName , PrimarySMTPAddress and emailaddresses. The email addresses should ignore selected domain suffix.

   

Summary

Few On Premises users needs to be migrated to Online. Exchange Technical Team require this report for ignoring already accepted domains.

 

Help

help Get-Mailbox

help Get-Mailbox -Parameter Filter

PowerShell Code

Get-mailbox -Filter {EmailAddresses -like "*DomainSuffix*" -or EmailAddresses -like "*DomainSuffix*"} -ResultSize Unlimited| 

Select SamAccountName , UserPrincipalName , PrimarySMTPAddress

Background

  1. Filter
  2. Operators
  3. ResultSize Unlimited
  4. Select