Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Importing multiple users for linked exchange accounts

$
0
0

This is for Exchange 2013 SP1 FYI

Ok, I am lost on this script...

I am trying to do a linked mailbox from a different forest using a CSV file. I can re-export the CSV if I need to gather other information.

Can I set all the attributes when I create the mailbox or do I need to have a separate line or script to set the attributes?

I know my import-csv is messed up but I am not sure how to fix it.

Script:

Import-Csv .\file.csv |foreach {

New-Mailbox -Database "uh-xchdb1" -Name "$_.DisplayName" -DisplayName “$_.DisplayName” -FirstName “$_.GivenName” -Initials “$_.Initials” -LastName “$_.Surname” -ExternalEmailAddress $_.EmailAddress -Title “$_.Title” -Department “$_.Department” -OfficePhone “$_.OfficePhone” -Fax “$_.Fax” -MobilePhone “$_.MobilePhone” -Alias "$_.SamAccountName" -LinkedDomainController "dc1.domain1.com" -LinkedMasterAccount health\$_.SamAccountName -OrganizationalUnit Users -UserPrincipalName $_.UserPrincipalName -LinkedCredential:(Get-Credential domain1\john)

}

csv file:

UserPrincipalName,SamAccountName,DisplayName,GivenName,OtherName,Initials,Surname,EmailAddress,Title,Department,OfficePhone,Fax,MobilePhone

testaddev2@domain1.com,testaddev2,Test I. Addev2,Test,,I,addev2,testaddev2@emailaddress.com,Sr VP,MIS,505-111-111,505-222-222,505-333-3333



Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>