Powershell To Locate, Create, Delete, and Edit Exchange Contacts

Hello,

I have been tasked with creating about 160 Exchange contacts. I'm finding that some of the email address listed are secondary email addresses for other users. I am in need of assistance for the following.

- Determine which contacts in my list have already been created.

- Determine which addresses on my list are already in Exchange as secondary SMTP addresses for different contacts/mailboxes.

- For the addresses that are not in Exchange I will need to mass create them.

- For the existing contacts that have addresses in my list, I will need to delete the secondary SMTP that matches ones in my list and create a new contact for the SMTP.

Really not sure how to work this one. Any assistance would be appreciated.

Thanks in advance,

January 29th, 2015 8:17pm

Hi,

Prewritten scripts can be found in the repository:

http://gallery.technet.microsoft.com/scriptcenter

I'd suggest asking your question over in the Exchange forums for your version of Exchange, but be aware that it is highly unlikely someone will have a script already written that will meet your requirements.

Free Windows Admin Tool Kit Click here and download it now
January 29th, 2015 8:33pm

Get-Recipient will show you which email addresses exist.

Get-Recipient justkarl@contoso.com

Karl

January 29th, 2015 9:03pm

Hi Green-Tech,

Please refer to this script to start, which can delete secondary SMTP addresses based on the string pattern "*@domain.local":

Get-MailContact -OrganizationalUnit "domain.local/OU" -Filter {EmailAddresses -like "*@domain.local"} -ResultSize unlimited -IgnoreDefaultScope | foreach {
$contact = $_
$email = $contact.emailaddresses
$email | foreach {
if ($_.smtpaddress -like "*@domain.local") {
$address = $_.smtpaddress
write-host "Removing address $address from Contact $contact.name
Set-Mailcontact -Identity $contact.identity -EmailAddresses @{Remove=$address}
$contact | set-mailcontact -emailaddresspolicyenabled $false} }}

Refer to:

Powershell script to delete secondary SMTP addresses of Exchange 2010 Mail Contacts

I also recommend you can post your current script and specific issue for a better response.

If there is anything else regarding this issue, please feel free to post back.

Best Regards,

Anna Wang
Free Windows Admin Tool Kit Click here and download it now
February 9th, 2015 5:38am

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

Other recent topics Other recent topics