Announcement

Collapse
No announcement yet.

EMS add X.500

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • EMS add X.500

    I am hoping someone may be able to help me figure, why the following will not work.. I am trying to add an X.500 address to a list of users that are in a CSV file.

    import-csv c:\temp\ContactUsers.csv | foreach {$temp = Get-mailContact -identity $_.Name $temp.EmailAddresses += "x500:" + $_.legacyexchangedn Set-mailcontact -instance $temp}

    I get the error:

    Get-MailContact : A positional parameter cannot be foudn that accepts argument 'Microsoft.Exchange.Data.ProxyAddressesCollection'
    At line:1 char:70

    However, If I manaully run the following it works.


    $Temp = Get-mailContact -identity "John Doe"
    $temp.EmailAddresses += "x500:" + "/O=MyDomain/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=Jdoe"
    Set-MailContact -instance $temp

    This is an example of my CSV file:

    name,legacyexchangedn
    John Doe,/O=myDomain/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=JDoe
    Mary Doe,/O=myDomain/OU=FIRST ADMINISTRATIVE GROUP/CN=RECIPIENTS/CN=MDoe

  • #2
    Re: EMS add X.500

    Try this,
    Code:
    import-csv "c:\temp\ContactUsers.csv" | foreach {
       $contact = Get-MailContact $_.name
       $contact.EmailAddresses += [Microsoft.Exchange.Data.CustomProxyAddress]( "x500:"+$_.legacyexchangedn )
       Set-MailContact $contact -EmailAddresses $contact.EmailAddresses
    }
    /Rems
    Last edited by Rems; 26th July 2011, 18:14.

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment


    • #3
      Re: EMS add X.500

      thank you, that worked

      Comment

      Working...
      X