Solved

Powershell create account with multiple email addresses

Posted on 2013-12-19
3
312 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

Are You Headed to Black Hat USA 2017?

Getting ready for Black Hat next week? Kick things off with the WatchGuard Badge Challenge and test your puzzle and cipher skills. Do you have what it takes to earn our limited edition Firebox Badge? Get started today - https://crimsonthorn.net

Question has a verified solution.

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

This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

627 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