script to create mailbox user and AD account from csv file

hello,

i have a csv file like this and i need to create ad account + mailbox, i have 2008 r2 AD and exchange 2013 server:

on csv, i have an attrbute tha i have added my self to active directory (ADSPECIAL)

the csv file:

givenName,SN,UPN,Alias,ADSPECIAL,OU
user1,Super01,u1.s01@domain.com,u1.s01,ATTRIBUTE001,domain.com/Users/california
...........

set the same password for all account

thanks for help
cawasakiAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Simon Butler (Sembee)ConsultantCommented:
The method outlined on this page will work:
http://www.codetwo.com/admins-blog/bulk-creation-of-mailboxes-on-microsoft-exchange-server-200720102013/

You will just need to adjust the parameters to match the information that you have.

The special parameter though may not work. If that is the same for all users, then I would create all of the users in their own OU, then once created add the parameter in bulk to all members of that OU, then move them to the proper home.

Simon.
0
cawasakiAuthor Commented:
hello,

already tested this web site script and dont work for me
0
Hello WorldCommented:
Hi,

Here's a article about Create bulk AD User and mailbox from CSV file for Windows Server 2008 R2, for your reference:
https://gallery.technet.microsoft.com/scriptcenter/PowerShell-Create-AD-users-97d6ee9c

Besides, you can contact Microsoft Exchange Team for further troubleshooting, if it can't work.

Regards,
0
Top Threats of Q1 & How to Defend Against Them

WEBINAR: Join WatchGuard CTO and our Threat Research Team on Aug. 2nd to hear the findings from our Q1 Internet Security Report! Learn more about the top threats detected in the first quarter and how you can defend your business against them!

Simon Butler (Sembee)ConsultantCommented:
Why doesn't it work?
That is a standard command for creating the objects. However with all CSV files you need to ensure the fields are named 100% correctly. That is the most common reason for the script failing.

Simon.
0
cawasakiAuthor Commented:
Hi simon,

its work, but th problem now is with attribute i have created my self in active directory, the name of attribute are "ADSPECIAL", how i can set value for every user for this attribute?
0
Simon Butler (Sembee)ConsultantCommented:
Try admodify.
https://admodify.codeplex.com/

Simon.
0
Will SzymkowskiSenior Solution ArchitectCommented:
Use the following powershell script to accomplish this...

Create the AD User First
Import-Module activedirectory
$Users = Import-csv "c:\filename.csv"
Foreach ($User in $Users) {
$User.givenName
$User.SN
$User.UPN
$User.OU
New-ADUser -GivenName $User.givenName -Name $User.givenName -SurName $User.SN -UniversalPrincipalName $User.UPN -Enabled $true -AccountPassword (ConvertTo-SecureString P@ssword -AsPlainText -force)
}

Open in new window


Create the Mailbox for the existing User/s above
$Users = Import-csv "c:\filename.csv"
Foreach ($User in $Users) {
$User.UPN
$User.Alias
$User.ADSPECIAL
Enable-Mailbox -Identity $User.UPN -Database servername\database -Alias $User.Alias
}

Open in new window


To Add your ADSPECIAL attribute you will need to run a third command as it does not allow you to do this using either New-Mailbox or Enable-Mailbox.

Add Custom Attribute
$Users = Import-csv "c:\filename.csv"
foreach ($User in $Users) {
$User.UPN
$User.ADSPECIAL
Set-Mailbox -Identity $User.UPN -CustomAttribute1 $User.ADSPECIAL
}

Open in new window


Just another note you need to make sure that you change the file name in each of the scripts to whatever you have named your file. You can also use the same csv as it references all of the columns that are within it.

WIll.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.