[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2823
  • Last Modified:

remove x400 addresses from exchange 2010 environment

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
Rhala
Asked:
Rhala
  • 9
  • 7
1 Solution
 
SubsunCommented:
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
 
RhalaAuthor Commented:
Dear Subsun,

thanks for your reply.

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

nothing
0
 
SubsunCommented:
Change $_.Prefix to $_.Prefixstring and try..
0
Simplify Active Directory Administration

Administration of Active Directory does not have to be hard.  Too often what should be a simple task is made more difficult than it needs to be.The solution?  Hyena from SystemTools Software.  With ease-of-use as well as powerful importing and bulk updating capabilities.

 
RhalaAuthor Commented:
i change it, it's same, nothing removed.
0
 
SubsunCommented:
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
 
RhalaAuthor Commented:
i need to run it for groups now, then for mailboxes.

how to make sure it's not in the default address policy??
0
 
SubsunCommented:
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
 
SubsunCommented:
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
 
RhalaAuthor Commented:
i remove x.400 from all email address policy we have, then i apply the commands, but it's still same:

1

2
0
 
SubsunCommented:
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
 
RhalaAuthor Commented:
yes, it's working now,,, thanks a lot

what about mailboxes??
0
 
RhalaAuthor Commented:
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
 
SubsunCommented:
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
 
RhalaAuthor Commented:
perfect help, very clear, thanks a lot Subsun
0
 
SubsunCommented:
You are welcome!
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

  • 9
  • 7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now