Solved

need a quest AD cmdlets or posh script to create bulk "mail enabled" users

Posted on 2013-11-20
4
556 Views
Last Modified: 2014-03-29
can someone provide a quest AD cmdlets script to create bulk mail enabled users from an input CSV?

[not mailbox enabled]

many thanks

S.
0
Comment
Question by:siber1
[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
4 Comments
 
LVL 53

Assisted Solution

by:Will Szymkowski
Will Szymkowski earned 250 total points
ID: 39664830
I am assuming that you want to create "new" mail users. If so use the powershell command below to accomplish this...

You need to construct your CSV file like the below example for this to work properly...

Name        ExternalEmailAddress   UserPrincipalName    sAMAccountName  Password
Jon Smith  jsmith@abc.com            jsmith@domain.com  jsmith                       P@ssworD
Mac Lin     Mlin@abc.com               mlin@domain.com     mlin                           P@ssworD
etc.....

$UserList = import-csv "c:\yourCSVhere"
foreach ($User in $UserList) {
$User.Name
$User.ExternalEmailAddress
$User.UserPrincipalName
$User.sAMAccountName
$User.Password
New-MailUser -Name $User.Name -ExternalEmailAddress $User.ExternalEmailAddress -UserPrincipalName $User.UserPrincipalName -sAMAccountName $User.sAMAccountName -Password $User.Password -AsSecureString
}

Open in new window


Will.
0
 
LVL 40

Accepted Solution

by:
Subsun earned 250 total points
ID: 39665881
Try this..

You need to run the code from Exchange Management Shell..
$password = convertto-securestring "p@ssw0rd" -asplaintext -force
Import-Csv C:\Test.csv | % {
New-MailUser `
	-Name "$($_.LastName) $($_.FirstName)" `
	-FirstName $_.FirstName `
	-LastName $_.LastName `
	-DisplayName "$($_.LastName) $($_.FirstName)" `
	-Password $password `
	-ExternalEmailAddress $_.Email `
	-UserPrincipalName "$($_.Account)@testdomain.com" `
	-OrganizationalUnit "Testdomain.com/mailenabled"
}

Open in new window

Sample C:\Test.csv file..
FirstName,LastName,Account,Email
Test,User,TUser,Tuser@Test.com
Test1,User1,TUser1,Tuser1@Test.com

Open in new window

0
 

Author Closing Comment

by:siber1
ID: 39666233
thanks Subsun / Spec01 both solutions work great.
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

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…
Recently, Microsoft released a best-practice guide for securing Active Directory. It's a whopping 300+ pages long. Those of us tasked with securing our company’s databases and systems would, ideally, have time to devote to learning the ins and outs…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 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