Solved

Powershell create account with multiple email addresses

Posted on 2013-12-19
3
303 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
  • 2
3 Comments
 
LVL 40

Accepted Solution

by:
Subsun earned 500 total points
Comment Utility
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
Comment Utility
thanks
0
 
LVL 40

Expert Comment

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

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
How to sign a powershell script so you can prevent tampering, and only allow users to run authorised Powershell scripts
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

762 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now