Link to home
Start Free TrialLog in
Avatar of cawasaki
cawasaki

asked on

script to create external contact in exchange 2013 from csv file

hello,

i need to create 1000 external contact on my exchange 2013 server.

my csv file look like this:

Display Name,Alias,externalsmtpaddress,legacyexchangedn
John SMITH,john.smith,john.smith@domain.com,/o=TEST/ou=Exchange Administrative Group.....

create every contact and use the legacyexchangedn value to create x500 address.
the name entry can be like alias.

thanks for help
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

Use the following command below...
$MailContacts = Import-csv "c:\filename.csv"
ForEach ($Item in $MailContacts) {
$Item.DisplayName
$Item.Alias
$Item.ExternalSMTPAddress
New-MailContact -Name $Item.DisplayName -DisplayName $Item.DisplayName -Alias $Item.Alias -ExternalEmailAddress $Item.ExternalSMTPAddress
}

Open in new window


Will.
Avatar of cawasaki
cawasaki

ASKER

hello will

and the x500 address? using legacyexchangedn value

thanks
ASKER CERTIFIED SOLUTION
Avatar of Will Szymkowski
Will Szymkowski
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hello

i need to use legacy exchange dn to create x500 address not legacy dn
i need to use legacy exchange dn to create x500 address not legacy dn

You can only modify the x500 attribute on a contact after it has been created. During the initial process you cannot add this value. That is why it is in 2 steps.

When you are using the Set-MailContact cmdlet, you need to call the mail contact that was created using the Identity parameter. For this i used the ExternalSMTPAddress to call the mail contact and then use the -EmailAddresses parameter to add the LegacyExchangeDN's from your CSV.

Have you tested this out?

Will.
thanks