Importing External mail contacts in to Exchange 2007
Hi There, We have few hundreds of external mail contacts which needs to be imported in to our Exchange 2007 org for the users to send the mail to those cotacts...my question is whether these contacts first needs to be imported in to AD and mail enable them using exchange 2007 or we can directly import them in to exchange and mail enable them...please help me get some solution... thanks thams
July 12th, 2008 5:32am

Hello, You can import mail contacts from CSV file to AD with EMSin bulk. I assume that you have below column in your CSV file. DisplayName,EmailAddress EMS command to import mail contacts into MailContacts OU: Import-Csv Contacts.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "MailContacts" } Reference: New-MailContact
Free Windows Admin Tool Kit Click here and download it now
July 12th, 2008 6:11am

Herere also some references which can help you: How to use Csvde to import contacts and user objects into Active Directory http://support.microsoft.com/kb/327620/en-us Cmdlet: export contact to csv file <csvde r objectclass=contact f c:\contact.csv> Notes: It can let you know the attributes which requirefor buildupa contact.The best way to let CSVDE work is to export existing data from a contact, then use that output to help you making input file.
July 14th, 2008 6:27am

hi, i have the same issue and i thought this was the answer however when i use the command i get an error saying that organizatonal unit MailContacts cannot be found and that i should check the spelling and try again.in the exchange management console the contacts OU is called "Mail Contact" so i tried that but got the same message.any ideas why?
Free Windows Admin Tool Kit Click here and download it now
December 12th, 2008 7:09am

Hi Dave, As you said that you have an OU called "Mail Contact" so you have to use "Mail Contact" (with a sapce in between) in the command instead of MailContact.OU name MailContact is just an example in the command it should be changed with the OU name you have in your environment.Amit Tank || MVP - Exchange || MCITP - Exchange 2007 || http://ExchangeShare.WordPress.com
December 12th, 2008 8:00am

yes, i tried that but got the same message.is the display name of the OU different to the actual name.in other words on the left hand side of the exchange management console it is called "Mail Contact" is this the actual name or just a display name.(does that make any sense?)is it case sensertive?
Free Windows Admin Tool Kit Click here and download it now
December 12th, 2008 8:18am

here is the message... command entered...Import-Csv C:\Contacts.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "Mail Contact" }Organizational unit "Mail Contact" was not found. Please make sure you have typed it correctly.At line:1 char:40+ Import-Csv C:\Contacts.csv | ForEach { N <<<< ew-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "Mail Contact" }there is one of these messages for each line in the .csv file.also does the csv file need to have the colum headers?
December 12th, 2008 8:24am

Are you checking correct title/heading of the "Mail Contact" column in EMC? "Mail Contact" is the recipient type detail also... You need to find the title/heading with name Organizational Unit in EMC or just give any OU name which exists in your AD structure. You can check the correct OU name in Active Directory Users & Computer on any of the domain controller or you may create a new OU.If you have multiple OUs with same name then you can give it in below format "Domain.com/Mail Contacts" also...Yes CSV file requires header like below.displayname, emailaddressAmit Tank || MVP - Exchange || MCITP - Exchange 2007 || http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
December 12th, 2008 8:38am

ok, cracked it :)one more thing, if i want to also hide these from the exchange address list is there another colum i can add to the csv file?if so what do i need to add to the command to bulk import them?
December 12th, 2008 9:03am

Same way you can run Set-MailContact cmdlet to hide those....Import-Csv Contacts.csv | ForEach {Set-MailContact -Name$_.DisplayName -HiddenFromAddressListsEnabled$true}Hope this helps...!!!Amit Tank || MVP - Exchange || MCITP - Exchange 2007 || http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
December 12th, 2008 9:52am

your a star!thanks sooo much :)
December 12th, 2008 10:22am

Nice comment... :)Amit Tank || MVP - Exchange || MCITP - Exchange 2007 || http://ExchangeShare.WordPress.com
Free Windows Admin Tool Kit Click here and download it now
December 12th, 2008 10:31am

Thanks :)I do however have another little problem.The powers at be have decided they dont want these contacts to be in the global address list.We are a school and they are afraid that sensitive emails will be sent out kids by mistake.Is it possible to have a sub set of addresses, or import them directly into another address list somehow?
December 16th, 2008 6:27am

oh and another one (well several)...when i run this command... Import-Csv C:\Contacts.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -HiddenFromAddressListsEnabled $true -OrganizationalUnit "Domain.local/MailContacts" }to import the .csv file and set the flag to not show in the address list i get the following... New-MailContact : A parameter cannot be found that matches parameter name 'HiddenFromAddressListsEnabled'.At line:1 char:145 and i have just noticed after i sucsessfully importingthe contacts (or some as a test)with the following...Import-Csv C:\Contacts.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "Domain.local/MailContacts" }when i look in theproperties of the contacts there is no tick box to say hide from address list.i have worked out how to add the contacts into a new address list in exchange but i cannot get that address list to display in outlook on the client computers.thanks for your continued help :)
Free Windows Admin Tool Kit Click here and download it now
December 16th, 2008 7:49am

Hi Dave, Sorry for the delay Well, you need to run set-mailcontact command to hide the address from GAL because that option is not available in New-MailContact command. Import-Csv C:\Contacts.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "Domain.local/MailContacts" Set-MailContact -Name$_.DisplayName -HiddenFromAddressListsEnabled$true } If contacts are already created then you need to just run the command I have given earlier to hide from GAL. Import-Csv Contacts.csv | ForEach {Set-MailContact -Name$_.DisplayName -HiddenFromAddressListsEnabled$true} Well workaround for the your situation, when students sends email to outside users by mistake, you can create a DL named StudentDL, add all students into it and set restriction on all the mail contacts which you created to reject message when it came from the member of student DL. Import-Csv Contacts.csv | ForEach {Set-MailContact -Name$_.DisplayName -RejectMessagesFromDLMembers StudentsDL } I would suggest you to test this workaround by adding your ID into StudentDL temporary and send a mail to any of the contact from above :) Keep in mind that, the things you set here, may take upto couple of hours to make effective due to information store services cache.
December 17th, 2008 11:05am

When I run the combined import and hide command I get the following... New-MailContact : Cannot bind parameter because parameter 'Name' is specified more than once. To provide multiple values to parameters that can accept multiple values, use the array syntax. For example, "-parameter value1,value2,value3". At line:1 char:187+ Import-Csv C:\Contacts.csv | ForEach { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "stwilfrid.local/MailContacts" Set-MailContact -Name <<<< $_.DisplayName -HiddenFromAddressListsEnabled $true } When I import the users using the command previously given then try to use your command to hide them from the GAL i get the following... Command in: Import-Csv C:\Contacts.csv | ForEach {Set-MailContact -Name $_.DisplayName -HiddenFromAddressListsEnabled $true} Outpot: cmdlet Set-MailContact at command pipeline position 1 Supply values for the following parameters: Identity: It then has a cursor for me to enter a value? If I type the Alias of a user it seems to accept it and then asks for another. (and successfully hides that alias fron the GAL) I assume the identity its asking for is in fact the Alias? If so is it just a case of adding an Alias Colum to the CSV and inserting a parameter to point to it? Would the extra part just be... -Alias $_.Alias Making the full command... Import-Csv C:\Contacts.csv | ForEach {Set-MailContact -Name $_.DisplayName -Alias $_.Alias -HiddenFromAddressListsEnabled $true} Also I think you miss understand the accidental email thing. Staff need to be able to email students but people are worried that confidential emails will be sent to them by mistake. To solve this they want a second address list for students totally separate from the GAL. Is that possible?
Free Windows Admin Tool Kit Click here and download it now
December 18th, 2008 5:03am

hi there, can anyone help with the above?
January 9th, 2009 4:18am

Hi,i got the same error and After 2 days of searching the here is my workingrun Syntax:Import-Csv Contacts.csv | ForEach-Object -Process { New-MailContact -Name $_.DisplayName -ExternalEmailAddress $_.EmailAddress -OrganizationalUnit "MailContacts" -Alias $_.DisplayName | Set-MailContact -HiddenFromAddressListsEnabled $true; }Enjoy
Free Windows Admin Tool Kit Click here and download it now
June 4th, 2009 6:03pm

Hi All, has anyone tried to import the external contacts and create a distribution group for the imported contacts? using the command let Thanks
January 12th, 2011 8:39pm

Hi All, has anyone tried to import the external contacts and create a distribution group for the imported contacts? using the command let Thanks Hi I have imported Mail Contacts and now i want to add telephone NUmber, Country, City, POsition, Company for the added Mail Contacts, can anyone help me on the same.
Free Windows Admin Tool Kit Click here and download it now
June 7th, 2012 8:46am

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

Other recent topics Other recent topics