December 6, 2012

Exchange 2010 - Removing mailbox aliases

How to remove mailbox aliases based on pattern string? 

First of all download and install Free PowerShell Commands for Active Directory

Removes all aliases of @example.local domain in User1 mailbox:
Get-QADUser -Identity User1 | Remove-QADProxyAddress -Pattern '*@example.local' 

Removes all @example.local aliases from Exchange:
Get-QADUser | Remove-QADProxyAddress -Pattern '*@example.local'

Use 'X400:*' pattern to remove all X400 email addresses from Exchange: 
Get-QADUser | Remove-QADProxyAddress -Pattern 'X400:*'

Note: These cmdlets are useful when there is no ability to apply address book policies (in case of Exchange infrastructure migration when email address were migrated from former Exchange)

For Distribution groups can be user Get-QADGroup cmdlet:
Get-QADGroup | Remove-QADProxyAddress -Pattern '*@example.local'

Note: Before any changes make sure that you have backed up your Active Directory. Also you can export to CSV file current information about Users and Groups aliases:

Get-QADUser | select name,@{Name='proxyAddresses';Expression={[string]::join(";", ($_.proxyAddresses))}} | export-csv C:\FileName1.csv

Get-QADGroup | select name,@{Name='proxyAddresses';Expression={[string]::join(";", ($_.proxyAddresses))}} | export-csv C:\FileName2.csv

No comments:

Post a Comment