?
Solved

remove x400 addresses from exchange 2010 environment

Posted on 2013-01-14
16
Medium Priority
?
2,649 Views
Last Modified: 2013-01-16
Dear All,

I want to delete all X400 address from my environment, I have only exchange 2010 in my environment.

I follow the following link to delete the addresses:
http://www.msexchange.org/articles-tutorials/exchange-server-2010/management-administration/x400-addresses-exchange-2010-part2.html

I apply the following command line:
ForEach ($mbx in (Get-DistributionGroup -ResultSize Unlimited)) {
      $addrs = $mbx.EmailAddresses | Where {$_.Prefix -ne "X400"}
      Set-DistributionGroup $mbx -EmailAddresses $addrs}

I got the following error:

error

Please I need your help to delete all X400 address using PowerShell for mailboxes & groups, I don’t want to use ADModify

Thanks
0
Comment
Question by:Rhala
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 7
16 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 2000 total points
ID: 38777202
I think you are running Set-DistributionGroup as a continuation of Where. Set-DistributionGroup should be next line..
ForEach ($mbx in (Get-DistributionGroup -ResultSize Unlimited)) {
      $addrs = $mbx.EmailAddresses | Where {$_.Prefix -ne "X400"}
      Set-DistributionGroup $mbx -EmailAddresses $addrs}

Open in new window

Or you can just add semicolon (;) to separate this commands..
ForEach ($mbx in (Get-DistributionGroup -ResultSize Unlimited)) {
      $addrs = $mbx.EmailAddresses | Where {$_.Prefix -ne "X400"};Set-DistributionGroup $mbx -EmailAddresses $addrs}

Open in new window

0
 

Author Comment

by:Rhala
ID: 38777373
Dear Subsun,

thanks for your reply.

i apply the command, but nothing happen, and still the x400 address in all groups there

nothing
0
 
LVL 40

Expert Comment

by:Subsun
ID: 38777401
Change $_.Prefix to $_.Prefixstring and try..
0
Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

 

Author Comment

by:Rhala
ID: 38778489
i change it, it's same, nothing removed.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 38778538
Did you remove the entry for X.400 addresses from Default Address Policy?

Also note the above command will remove X.400 from Distribution Groups not from mailboxes..

For mailboxes run..
ForEach ($mbx in (Get-Mailbox -ResultSize Unlimited)) {

      $addrs = $mbx.EmailAddresses | Where {$_.Prefixstring -ne "X400"}

      Set-Mailbox $mbx -EmailAddresses $addrs

}

Open in new window

0
 

Author Comment

by:Rhala
ID: 38779098
i need to run it for groups now, then for mailboxes.

how to make sure it's not in the default address policy??
0
 
LVL 40

Expert Comment

by:Subsun
ID: 38779692
how to make sure it's not in the default address policy??
You can Check i in Exchange Management Console under Organization Configuration -> Hub Transport, in the Email Address Policies tab.
0
 
LVL 40

Expert Comment

by:Subsun
ID: 38779872
FYI.. I have tested the following script in my lab and it's working fine..
ForEach ($mbx in (Get-DistributionGroup -ResultSize Unlimited)) {
      $addrs = $mbx.EmailAddresses | Where {$_.Prefix -ne "X400"};Set-DistributionGroup $mbx -EmailAddresses $addrs}

Open in new window

Teat Result
0
 

Author Comment

by:Rhala
ID: 38782316
i remove x.400 from all email address policy we have, then i apply the commands, but it's still same:

1

2
0
 
LVL 40

Expert Comment

by:Subsun
ID: 38782343
Why Ctrl +C??  it will terminate the script.. To run the script you need to press Enter key until you get the PS prompt again..
0
 

Author Comment

by:Rhala
ID: 38782347
yes, it's working now,,, thanks a lot

what about mailboxes??
0
 

Author Comment

by:Rhala
ID: 38782408
Hi Subsun, Commands working perfectly, i just got the three errors below which i hope you can help to solve them:

The proxy address "smtp:khalid@nt.com.sa" is already being used by "ac.local/AC-Contacts/_Khalid M. Al Bal".
Please choose another proxy address.
    + CategoryInfo          : NotSpecified: (ac.local/ACS-Use...Khalid Al-Bal:ADObjectId) [Set-Mailbox], ProxyAddress
   ExistsException
    + FullyQualifiedErrorId : 7EA0AE9,Microsoft.Exchange.Management.RecipientTasks.SetMailbox
    + PSComputerName        : exch-hc-1.ac.local


The proxy address "smtp:mshammari@ac.com" is already being used by "ac.local/AC-UsersSales/Moha
Shammari". Please choose another proxy address.
    + CategoryInfo          : NotSpecified: (ac.local/AC-Use...ays/Shammari:ADObjectId) [Set-Mailbox], ProxyAddress
   ExistsException
    + FullyQualifiedErrorId : EA6AF758,Microsoft.Exchange.Management.RecipientTasks.SetMailbox
    + PSComputerName        : exch-hc-1.ac.local



The proxy address "smtp:mshammari@ac.com" is already being used by
"ac.local/ACS-Userssales/Shammari". Please choose another proxy address.
    + CategoryInfo          : NotSpecified: (ac.local/AC-Use...eel Shammari:ADObjectId) [Set-Mailbox], ProxyAddress
   ExistsException
    + FullyQualifiedErrorId : 617C0F2D,Microsoft.Exchange.Management.RecipientTasks.SetMailbox
    + PSComputerName        : exch-hc-1.ac.local
0
 
LVL 40

Expert Comment

by:Subsun
ID: 38782435
This means the same proxy address is assigned to more than one user, the proxy address should be unique else use will not receive emails.

For example you tried to assign email address khalid@nt.com.sa to mailbox which is already assigned to ac.local/AC-Contacts/_Khalid M. Al Bal.

The proxy address "smtp:khalid@nt.com.sa" is already being used by "ac.local/AC-Contacts/_Khalid M. Al Bal".
0
 

Author Closing Comment

by:Rhala
ID: 38782498
perfect help, very clear, thanks a lot Subsun
0
 
LVL 40

Expert Comment

by:Subsun
ID: 38782514
You are welcome!
0

Featured Post

Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In-place Upgrading Dirsync to Azure AD Connect
Check out this step-by-step guide for using the newly updated Experts Exchange mobile app—released on May 30.
To add imagery to an HTML email signature, you have two options available to you. You can either add a logo/image by embedding it directly into the signature or hosting it externally and linking to it. The vast majority of email clients display l…
This video discusses moving either the default database or any database to a new volume.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question