Solved

Powershell create account with multiple email addresses

Posted on 2013-12-19
3
311 Views
Last Modified: 2013-12-30
I have this working script but what I would like to do is import multiple emails at the sametime of creating accounts. Is this posssible with what I have. Hypothetically I would have a field from the file I am impoting from with .csv with fields like below

name  alias  userprincipalname  organizationalunit  email addresses
test      test   test                            contoso.local             test1@test.com, test@contoso.local


Import-CSV C:\temp\users.CSV | % {
New-Mailbox -Name $_.Name `
-Alias $_.Alias `
-UserPrincipalName $_.UserPrincipalName `
-OrganizationalUnit $_.OrganizationalUnit `
-Password $pass `
-ResetPasswordOnNextLogon $true
}
0
Comment
Question by:techdrive
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
ID: 39729433
Try..
Import-CSV C:\temp\users.CSV | % {
New-Mailbox -Name $_.Name `
-Alias $_.Alias `
-UserPrincipalName $_.UserPrincipalName `
-OrganizationalUnit $_.OrganizationalUnit `
-Password $pass `
-ResetPasswordOnNextLogon $true

$User = $_.Alias

$_.emailaddresses -split "," | % {Set-Mailbox $User -EmailAddresses @{add=$_}}
}

Open in new window

emailaddresses value should be like test1@test.com, test@contoso.local
0
 

Author Comment

by:techdrive
ID: 39729553
thanks
0
 
LVL 40

Expert Comment

by:Subsun
ID: 39732515
If you don't have any further queries then do not forget to close the question... :-)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Create and license users in Office 365 in bulk based on a CSV file. A step-by-step guide with PowerShell script examples.
Previously, on our Nano Server Deployment series, we've created a new nano server image and deployed it on a physical server in part 2. Now we will go through configuration.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question