Solved

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

Posted on 2013-11-20
4
555 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
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

Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

Question has a verified solution.

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

This article runs through the process of deploying a single EXE application selectively to a group of user.
The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …

777 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