How to: Removing x400 addresses (via Powershell)
Hi there
we have a few accounts and all of them have x400 addresses. now we'd like to remove them from the users.
what i've already done: i removed the x400 entry on the "default e-mail address policy" but on all user accounts the x400 still resists.
question: how can i remove the x400 address for all the user accounts?
maybe there is something to do with EMS? thanks for your input,
uerueluem
August 16th, 2010 9:57am
Please check whether the below article can help you:
http://support.microsoft.com/kb/318774.
Dinesh
Free Windows Admin Tool Kit Click here and download it now
August 16th, 2010 4:35pm
In EMS, you can use a powershell script like this:
foreach ($mbx in (get-mailbox -resutlsize unlimited){
$addrs = $mbx.emailaddresses |? {$_.prefixstring -ne "x400"}
set-mailbox $mbx -emailaddresses $addrs -whatif
}
Run that, and if the results look right, remove the -whatif switch from the set-mailbox and re-run it to do the updates.[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
August 16th, 2010 4:52pm
I have changed the script a littlebit because it wasn't working as is.
Now it looks like that:
foreach ($mbx in get-mailbox){
$addrs = $mbx.emailaddresses |? {$_.prefixstring -ne "x400"}
set-mailbox $mbx -emailaddresses $addrs
}
but even if I changed the script, it wont remove the x400 records from my Users :-(
thanks to mjolinor
Free Windows Admin Tool Kit Click here and download it now
August 18th, 2010 5:23pm
i also found another way to do it, but as the script also the program ADModify does not remove the x400 addresses. :(
http://msexchangetips.blogspot.com/ --> Exchange: Bulk Remove X.400 Address Using Admodify
August 18th, 2010 6:03pm
Mjolinor missed a “)” in the first line
foreach ($mbx in (get-mailbox -resutlsize unlimited)){James Luo
TechNet Subscriber Support (http://technet.microsoft.com/en-us/subscriptions/ms788697.aspx)
If you have any feedback on our support, please contact tngfb@microsoft.com
Free Windows Admin Tool Kit Click here and download it now
August 19th, 2010 4:32am
I also misspelled -resultsize :(
[string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
August 19th, 2010 5:02am
How's the result after using the modified script from mjolinor?
I have tested it in the labJames Luo
TechNet Subscriber Support (http://technet.microsoft.com/en-us/subscriptions/ms788697.aspx)
If you have any feedback on our support, please contact tngfb@microsoft.com
Free Windows Admin Tool Kit Click here and download it now
August 20th, 2010 4:18am
The following Script worked successfully
foreach ($mbx in (get-mailbox )){
$addrs = $mbx.emailaddresses |? {$_.prefixstring -ne "x400"}
set-mailbox $mbx -emailaddresses $addrs -whatif
}
#to execute the script, remove the "-whatif", otherwise it's just a test
July 27th, 2011 6:14pm
The following Script worked successfully
foreach ($mbx in (get-mailbox )){
$addrs = $mbx.emailaddresses |? {$_.prefixstring -ne "x400"}
set-mailbox $mbx -emailaddresses $addrs -whatif
}
#to execute the script, remove the "-whatif", otherwise it's just a test
works for x500 thx very much
Free Windows Admin Tool Kit Click here and download it now
January 23rd, 2012 10:39am
Can this be done using this method for Distribution Groups?
May 18th, 2012 7:03am
Figured it out for Distribution Groups;
To test use this command in EMS;
foreach ($mbx in (Get-DistributionGroup -resultsize unlimited)){
$addrs = $mbx.emailaddresses |? {$_.prefixstring -ne "x400"}
Set-DistributionGroup $mbx -emailaddresses $addrs -whatif
}
Then to remove X400 addresses use this command in EMS;
foreach ($mbx in (Get-DistributionGroup -resultsize unlimited)){
$addrs = $mbx.emailaddresses |? {$_.prefixstring -ne "x400"}
Set-DistributionGroup $mbx -emailaddresses $addrs
}
Free Windows Admin Tool Kit Click here and download it now
May 18th, 2012 1:02pm