Is there a way to delete them automatically?
Hi all, I made a mistake to create policy to update users' email address with the wrong smtp address in exchange 2003 and exchange 2007. Is there a way to remove it from every user autmatically instead of removing it manaully? Thanks a lot.
July 16th, 2010 12:31am

Hi all, I made a mistake to create policy to update users' email address with the wrong smtp address in exchange 2003 and exchange 2007. Is there a way to remove it from every user autmatically instead of removing it manaully? Thanks a lot. In exchange 2007, you can write a Powershell script to remove email addresses in bulk if those email addresses have some pattern, e.g. u can remove all email addresses which are not primary smtp address OR which belong to a specific @domain.com OR which have some specific word in it etc. I wrote such a script last month, plz have a look into this thread: remove secondary email address of a lists of users with powershel http://social.technet.microsoft.com/Forums/en-US/exchangesvradmin/thread/4ca1f6dd-07a9-44ac-a32f-f63d42cfc7d1 You can also remove email addresses using ADModify.net (an application), which works on both Ex 03 and 07. Plz have a look into this thread: Exchange 2007: Delete SMTP email address for bulk user http://social.technet.microsoft.com/Forums/en-US/exchangesvrdeploy/thread/69f2e199-dcdd-4436-812e-051e1e4a63e3 Regards,Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM) www.HostingController.com
Free Windows Admin Tool Kit Click here and download it now
July 16th, 2010 12:47am

Another tool that you could use with be admodify, which is available from Codeplex. Simon.Simon Butler, Exchange MVP. http://blog.sembee.co.uk , http://exbpa.com/
July 16th, 2010 3:17am

Thank you. From this script, will it remove all secondary email addresses? or I can specify certian domain like @xyz.com "*_site*" and "Remove smtp adress: " in your script, do I need to make a change to them? I guess that I need to change "*_site*" and remove smtp address: is the command? (I am quite new to script) Get-Content C:\users.txt |Get-Mailbox | foreach{ for ($i=0;$i -lt $_.EmailAddresses.Count; $i++) { $address = $_.EmailAddresses[$i] if ($address.IsPrimaryAddress -eq $false -and $address.SmtpAddress -like "*_site*" ) { Write-host("Remove smtp adress: " + $address.AddressString.ToString() ) $_.EmailAddresses.RemoveAt($i) } } Set-Mailbox -Instance $_ }
Free Windows Admin Tool Kit Click here and download it now
July 16th, 2010 3:24am

From this script, will it remove all secondary email addresses? or I can specify certian domain like @xyz.co The above script reads the contents of text file, where in each row there is a mailbox primary smtp address. So scripts get the mailbox for each user in text file and then parses each of the secondary smtp address whether secondary email address contains the word _site somewhere, and removes it if it exists. "*_site*" and "Remove smtp adress: " in your script, do I need to make a change to them? I guess that I need to change "*_site*" and remove smtp address: is the command? (I am quite new to script) remove smtp address is not command, write-host is the command which prints a message on screen, so it prints: Remove smtp address: emailAddresssHere and next line $_.EmailAddresses.RemoveAt($i) actually removes the email address. If u are new to powershell then I wud suggest u to spend some time to learn its basics, there are lots of online tutorials for this. Also, following script will remove all secondary email addresses from mailboxes which has "@xyz.com" in their secondary email addresses. Get-Mailbox -ResultSize Unlimited | foreach{ for ($i=0;$i -lt $_.EmailAddresses.Count; $i++) { $address = $_.EmailAddresses[$i] if ($address.IsPrimaryAddress -eq $false -and $address.SmtpAddress -like "*@xyz.com" ) { Write-host("Removing smtp adress: " + $address.AddressString.ToString() ) $_.EmailAddresses.RemoveAt($i) } } Set-Mailbox -Instance $_ } "Get-Mailbox -ResultSize Unlimited" will retrieve all mailboxes from exchange. You can change this to retrieve mailboxes only from a certain OU like this Get-Mailbox -ResultSize Unlimited -OrgaanizationalUnit "YourADDomain.com\YourOUName" I Hope that I have explained it. Regards,Laeeq Qazi|Team Lead(Exchange + Sharepoint + BES + DynamicsCRM) www.HostingController.com
July 16th, 2010 12:59pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics