Problem on Powershell when trying to export A domain's Mail User to B domain's as Contacts.
I understand this suppose to be asking on powershell form, but it maybe links with some exchange server export data, so I choose to ask here.Beg your pardon if makes any inconvenience,We have 2 domain, and both domain install exchange 2007,(one already done, another is upgrading from lotus domino)but both will uses a same external Email domain (@same.com),so we had a trick to deal with internal mail flow.step 1 at forest A.com (userA@same.com)get-mailbox | export-csv -encoding "unicode" mail.csvnow let's goes to forest B.com (userB@same.com)Trying to modify contact's external email address from userA@same.com -> user@A.com#copy mail.csv to B.com exchange server and keep going below.step 2, when I try to wrote the script:#userB = alias parameterI type[PS] import-csv mail.csv | foreach {New-MailContact -ExternalEmailAddress "SMTP:" + $_.Alias + "@A.com" + .....}and the result shows :New-MailContact : Cannot bind parameter 'ExternalEmailAddress' to the target. Exception setting "ExternalEmailAddress": "cause address 'SMTP:' is not blah blah blah...."why $_.alias dosn't work ? but commands like below[PS] Import-Csv mail.csv | foreach {$_.Alias}works perfectly.Any suggestion ??
June 13th, 2008 12:34pm

Hi, I think ExternalEmailAddress accepts only one variable and you are doing merging of variables while passing the value of parameter in it. Try this one. import-csv mail.csv | foreach { $email = "SMTP:" + $_.Alias + "@catcher.com.tw" +.... New-MailContact -ExternalEmailAddress $email .....} <--- this is next line and press entertwo timeswhen you complete full command.
Free Windows Admin Tool Kit Click here and download it now
June 13th, 2008 1:13pm

Yeah , that's exactly what I want.Thanks for your help.
June 14th, 2008 6:51am

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

Other recent topics Other recent topics