Solved

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

Posted on 2013-11-20
4
551 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
4 Comments
 
LVL 53

Assisted Solution

by:Will Szymkowski
Will Szymkowski earned 250 total points
Comment Utility
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
Comment Utility
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
Comment Utility
thanks Subsun / Spec01 both solutions work great.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Exchange server is not supported in any cloud-hosted platform (other than Azure with Azure Premium Storage).
Learn to move / copy / export exchange contacts to iPhone without using any software. Also see the issues in configuration of exchange with iPhone to migrate contacts.
In this Micro Video tutorial you will learn the basics about Database Availability Groups and How to configure one using a live Exchange Server Environment. The video tutorial explains the basics of the Exchange server Database Availability grou…
how to add IIS SMTP to handle application/Scanner relays into office 365.

772 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

10 Experts available now in Live!

Get 1:1 Help Now