Screenshot of the properties of any account before we continue processing
Because in fact, there is no function to remove the old domain from the system from the user's E-mail Addresses list (also known as ProxyAddresses ), we can handle it manually in each mailbox section. to remove old address components, or use PowerShell for batch processing.
Some assumptions are made based on user needs:
- You want to use this function on each domain mailbox
- You have full administrative rights or at least have the right permissions to manage the entire mailbox section
- Use this function from Exchange Management Shell
- Replace OLDDOMAIN.com with the domain name component you want to remove from the email address
The code used in this hypothetical situation is as follows:
#Get all mailboxes into an Array
$ mbxs = @ (get-mailbox -Resultsize Unlimited)
#Iterate through each mailbox
foreach ($ mbx in $ mbxs)
{
#Create hai ảnh trong các địa chỉ thư trong trả về thư mục
$ CurrentList = $ mbx.emailaddresses
#the second copy is the one where changes will take place.
$ NewList = $ mbx.emailaddresses
#Iterate qua mỗi địa chỉ trong danh sách danh sách.
foreach ($ Address in $ CurrentList)
{
#see if địa chỉ hiện thời được kết thúc các trường bạn muốn gỡ bỏ
if ($ Address.tostring () -match "OLDDOMAIN.com")
{
#If được tìm thấy match, gỡ bỏ địa chỉ từ từ danh sách.
$ NewList - = $ Address
}
}
#Overwrite the old list with new list.
set-mailbox $ mbx -emailaddresses $ NewList
}
When the test is completed with the newly provided code, the results are very positive, so it will be very effective when applied in practice.
The entire section of OLDDOMAIN.com SMTP address has been successfully deleted
But everyone should keep in mind that the above code only works on Exchange 2007 platform, doesn't work with Exchange 2010. Wish you success!