IMPORT USER CSV AND CHANGE EMAIL ADDRESSES
Hello, I do an import of several users on my Exchange 2007 environnement. The below ps1 file is based on a CSV file that is copied here: C:\Scripts\USERS.csv when users have to be created. I just execute the 2 ps1 file below: First ps1: import-csv "C:\Scripts\USERS.csv" | foreach {enable-MailUser -identity $_.identity -ExternalEmailAddress $_.ExternalEmailAddress} | Set-Mailuser -emailaddresspolicyenabled:$True Start-EdgeSynchronization second ps1: Get-MailUser -ResultSize Unlimited | Where {$_.emailaddresspolicyenabled -like "True"} | Set-MailUser -emailaddresspolicyenabled:$False CSV file: Identity,ExternalEmailAddress "company.intra/UK/Users/GRAIG SMITH","graig.smith@compa-ny.com" After I run the script, If I check the users properties, I get that: Before: ExternalEmailAddress: SMTP:graig.smith@compa-ny.com EmailAddresses: {SMTP:graig.smith@compa-ny.com, smtp:GRAIG2012@com.intra} As per the below example, I would need to add an email address that would take the existing one GRAIG2012@com.intra and would replace com.intra by ny.intra. So it should read GRAIG2012@ny.intra Once that smtp address added, I would need to set that one as ExternalEmailAddress. After: ExternalEmailAddress: SMTP:GRAIG2012@pany.intra EmailAddresses: {smtp:GRAIG2012@panu.intra, SMTP:graig.smith@compa-ny.com, smtp:GRAIG2012@com.intra} So, what I would like to get is to do those changes using power shell and not the EMC and do those change base on the csv file for each users. Hope I have been clear enough! Many Thanks in advance, Graig
October 10th, 2012 5:54am

Sorry I forgot to mention, that the added address has to be based on the domain. I see that in the DistinguishedName it is indicated. The below example show that the user belong to different domain: 1) DistinguishedName: CN=GRAIG SMITH,OU=D3,OU=Users,OU=London,DC=pany,DC=UK,DC=intra 2) DistinguishedName: CN=JOHN ADAM,OU=G6,OU=Users,OU=Dublin,DC=pany,DC=IRL,DC=intra So for 1) the added email address should be GRAIG2012@pany.UK.intra and the second example: JOHN2012@pany.IRL.intra
Free Windows Admin Tool Kit Click here and download it now
October 10th, 2012 6:49am

Hi First when you want to change the EmailAddresses, you have to confirm that it is PrimarySmtpAddress or not. If yes, you have to set on PrimarySmtpAddress. Then, emailaddresspolicyenabled should disable. So finally, which EmailAddresses would you like to have, and which one is PrimarySmtpAddress? CheersZi Feng TechNet Community Support
October 12th, 2012 4:44am

Hello, When I wanna change the EmailAddress, the primary SMTP is already set and the emailaddresspolicyenabled is already disable. So from here I need to add an SMTP address that should be based on the SAMaccountName following by "@" and the domain pany.UK.intra or pany.IRL.intra. that new added emailadress should afterward be set as Externalemailaddress Is you need further information, please let me know. Graig
Free Windows Admin Tool Kit Click here and download it now
October 27th, 2012 2:32am

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

Other recent topics Other recent topics