+ Post New Thread
Results 1 to 3 of 3
Enterprise Software Thread, Exchange 2010 Import Mail Contacts in Technical; ...
  1. #1

    Join Date
    Jul 2011
    Thank Post
    Thanked 1 Time in 1 Post
    Rep Power

    Exchange 2010 Import Mail Contacts

    Hi, I was wondering if someone could spot what I'm doing wrong. I am trying to import Mail Contacts (users with external email addresses) into an OU in our AD. The OU exists and I have others there. On the command line, in Exchange 2010, I can type the following and it works fine :

    [PS] C:\etc \etc>New-MailContact -Name "Some Person" -ExternalEmailAddress spersonATaddress.co.uk -OrganizationalUnit "brcc.local/BRCC/WsgflAccounts"
    …and I get:

    [PS] C:\etc\etc>New-MailContact -Name "Some Person" -ExternalEmailAddress sperso
    nATaddress.co.uk -OrganizationalUnit "brcc.local/BRCC/WsgflAccounts"

    Name Alias RecipientType
    ---- ----- -------------
    Some Person SomePerson MailContact

    I then remove this contact and try to add it through the next stage.
    That’s fine for one or 2, but for 200 or so, I need a bulk import. I've read numerous Google results and so I tried this:
    Import-CSV "c:\files\test.csv" | ForEach-Object { New-MailContact -Indentity $_.Name -ExternalEmailAddress $_.ExternalAddress -OrganizationalUnit $_.orgu }

    …the csv looks like this:
    Some Person,spersonATjspc.co.uk,brcc.local/BRCC/WsgflAccounts

    …but then I get this error:

    A positional parameter cannot be found that accepts argument 'Some Person'.
    + CategoryInfo : InvalidArgument: ( [New-MailContact], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,New-MailContact

    Even adding double quotes to Some Person and the OU position didn't make any difference.

    I have obviously missed something, but can't, for the life of me, work out what..:-(
    Thanks for any tips.....

  2. #2

    Join Date
    Dec 2008
    Thank Post
    Thanked 326 Times in 316 Posts
    Rep Power
    Try something like the below

    Import-CSV c:\testimport1.csv | ForEach-Object { New-MailContact -Name $_."DisplayName" -DisplayName $_."DisplayName" -ExternalEmailAddress $_."EmailAddress" -LastName $_."LastName" -FirstName $_."FirstName" -OrganizationalUnit $_."CN=Email,DC=domain,DC=com" }

  3. #3

    Join Date
    Jul 2011
    Thank Post
    Thanked 1 Time in 1 Post
    Rep Power
    Hi sukh,
    Thanks for your input, but I'm not sure about your section on the end = '-OrganizationalUnit $_."CN=Email,DC=domain,DC=com" '. Is that the column heading or the format of the column? - the OU where I'd like the contact is 'OU=ContactAccounts,OU=staff,DC=site,DC=com' or the canonicalName is 'site.com/staff/ContactAccounts'. If 'cn' is required of the OU, the properties within 'ADSI edit' are <Not Set>.

+ Post New Thread

Similar Threads

  1. exchange 2010 cant sent mail externally
    By RabbieBurns in forum Windows Server 2008 R2
    Replies: 10
    Last Post: 18th March 2013, 07:15 AM
  2. Exchange 2010 incoming mail file sized
    By HMCTech in forum Enterprise Software
    Replies: 9
    Last Post: 29th April 2011, 02:56 AM
  3. Exchange 2010 Internal mail going to junk
    By HMCTech in forum Enterprise Software
    Replies: 7
    Last Post: 11th April 2011, 04:50 PM
  4. Exchange 2007 Mail Contacts
    By IGB in forum Windows
    Replies: 19
    Last Post: 1st March 2010, 04:17 PM
  5. Exchange mail contacts help.
    By boomam in forum Windows
    Replies: 1
    Last Post: 12th January 2009, 02:05 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts