Help-Import csv from SQL as Email Contacts for GAL-
Here's what I want to accomplish -export a CSV from legacy app with customer information -I want that same customer information to be available in GAL (phones cant browse other address books) -PS to import into AD/Exchange 2007 as mail enabled contacts -I want to be able to basically re-run on a schedule-so if user object already exists, I want to allow the script to move ahead to update the remaining changes. PS File: Add-Content c:\scripts\debug.txt "::Starting Import: "; $err = ""; Import-Csv c:\scripts\importcustomers.csv | ForEach-Object{ New-MailContact -DomainController dc1.xxxx.com -Name $_."Full Name" -ExternalEmailAddress $_."email" -OrganizationalUnit "xxxx.com/Customers" -ErrorAction SilentlyContinue -ErrorVariable +err Set-Contact -identity $_."Full Name" -DomainController dc1.xxx.com -Company $_."Company" -Office $_."Business" -DisplayName $_."Full Name" -Fax $_."Business Fax" -OtherTelephone $_."Business2" -Title $_."Job Title" -pager $_."Pager" -HomePhone $_."Home" -ErrorAction SilentlyContinue -ErrorVariable +err; Set-MailContact -identity $_."Full Name" -DomainController dc1.xxxx.com -ErrorAction SilentlyContinue -ErrorVariable +err; } Add-Content c:\scripts\debug.txt $err; CSV Example: "Full Name","Company","email","Job Title","Other","Business Fax","Business2","Business","Mobile","Home","Pager" " PRODUCE INC. - ALICE"," PRODUCE, INC.",Unavailable2@xxx.com,PROBUYER,,,, ,5555559, , I can manually add attributes in powershell- I'm not entirely sure that procedurally I am framing this correctly. TIA!!
April 6th, 2010 12:16am

Here's what I want to accomplish -export a CSV from legacy app with customer information -I want that same customer information to be available in GAL (phones cant browse other address books) -PS to import into AD/Exchange 2007 as mail enabled contacts -I want to be able to basically re-run on a schedule-so if user already exists, I want to skip and move ahead past PS File: Add-Content c:\scripts\debug.txt "::Starting Import: "; $err = ""; Import-Csv c:\scripts\importcustomers.csv | ForEach-Object{ New-MailContact -DomainController dc1.xxxx.com -Name $_."Full Name" -ExternalEmailAddress $_."email" -OrganizationalUnit "xxxx.com/Customers" -ErrorAction SilentlyContinue -ErrorVariable +err Set-Contact -identity $_."Full Name" -DomainController dc1.xxx.com -Company $_."Company" -Office $_."Business" -DisplayName $_."Full Name" -Fax $_."Business Fax" -OtherTelephone $_."Business2" -Title $_."Job Title" -pager $_."Pager" -HomePhone $_."Home" -ErrorAction SilentlyContinue -ErrorVariable +err; Set-MailContact -identity $_."Full Name" -DomainController dc1.xxxx.com -ErrorAction SilentlyContinue -ErrorVariable +err; } Add-Content c:\scripts\debug.txt $err; CSV Example: "Full Name","Company","email","Job Title","Other","Business Fax","Business2","Business","Mobile","Home","Pager" " PRODUCE INC. - ALICE"," PRODUCE, INC.",Unavailable2@xxx.com,PROBUYER,,,, ,5555559, , I can manually add attributes but again this needs to skip ahead if user already exists but update attributes if phone # changes etc. TIA!!
Free Windows Admin Tool Kit Click here and download it now
April 6th, 2010 12:32am

"I can manually add attributes but again this needs to skip ahead if user already exists but update attributes if phone # changes etc." This part seems a little ambiguous. If you "skip ahead" if the user already exists, you won't know if any of the attributes changed, and need to be updated.
April 6th, 2010 3:06am

"I can manually add attributes but again this needs to skip ahead if user already exists but update attributes if phone # changes etc." This part seems a little ambiguous. If you "skip ahead" if the user already exists, you won't know if any of the attributes changed, and need to be updated. edited above
Free Windows Admin Tool Kit Click here and download it now
April 6th, 2010 3:38am

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

Other recent topics Other recent topics