Bulk creation of AD user accounts with Exchange 2010 sp1 supplied script

Status
Not open for further replies.
C

Crustbusta



I've believe that I have recently read somewhere that Exchange 2010 sp1 comes supplied with a script or similar to allow for the creation of user account objects in AD. I've now how a need to use this but can't for the life of me remember the details. Can someone please put me out of my misery.

Many thanks in advance
 
B

busbar

C

Crustbusta



Thanks I appreciate the information however I know I read something somewhere and that's bugging me so I was just wondering if anyone else had read the same thing.

Anybody ??? :)
 
S

Steve Goodman



No there is no special script in SP1 for this. New-Mailbox and New-MailUser do this though (with Exchange attributes populated) and it's easy to use something like a CSV file as input.

What are you trying to achieve? Someone here can probably help with a small script.

Steve

Steve Goodman
Check out my Blog for more Exchange info or find me on Twitter
 
C

Crustbusta



Hi Steve,

Thanks for the info.

I'm just trying to create a couple of hundred of AD user accounts quickly using the following attributes contained in a CSV file.

Pete ....

GivenName Surname SamAccountName DisplayName

Password
 
S

Steve Goodman



Hiya,

I'd also add a UserPrincipalName value to the CSV file, then something like:

This to test (with the WhatIf parameter)

Import-CSV .\input.csv | %{ New-Mailbox $_.SamAccountName -DisplayName $_.DisplayName -SamAccountName $_.SamAccountName -UserPrincipalName $_.UserPrincipalName -FirstName $_.GivenName -LastName %_.Surname -Password (Convertto-SecureString -Force -AsPlainText $_.Password) -WhatIf}

Then to do it (taking off the WhatIf parameter)

Import-CSV .\input.csv | %{ New-Mailbox $_.SamAccountName -DisplayName $_.DisplayName -SamAccountName $_.SamAccountName -UserPrincipalName $_.UserPrincipalName -FirstName $_.GivenName -LastName %_.Surname -Password (Convertto-SecureString -Force -AsPlainText $_.Password)}

You can also add extra parameters to the New-Mailbox before the last }, such as Organizational Unit, Database etc, policies etc. Check out Get-Help New-Mailbox -Detailed for more info.
Steve

Steve Goodman
Check out my Blog for more Exchange info or find me on Twitter
 
B

Brian Day MCITP



You want to use Import-CSV piped into New-Mailbox. There are certain parameters which are required in order to make a new mailbox and they aren't all in your list. I've used the required list below.

For example if the first line of your CSV file was;

GivenName,SurName,SamAccountName,DisplayName,UserPrincipalName,Name,Password

...those values would be used as properties for each object (line) in the CSV file you import.

Here is an example you can try in your lab and massage as necessary.

First import the values to a variabl with something like; $MailboxesToMake = $Import-CSV c:\myfile.csv

Then you run something like this...

$MailboxesToMake | foreach {New-Mailbox -Displayname $_.DisplayName -Firstname $_.GivenName -LastName $_.SurName -SamAccountName $_.SamAccountName -Name $_.Name -Password $_.Password}

That pipes the objects from $MailboxesToMake to a foreach loop which then executes the code block inside the {} one time per object. The $_ notation in PowerShell is the 'current object' you are working with. You'll notice there is no -Database parameter up above, so Exchange would randomly choose a database in the local AD site to create the mailbox in. If you wanted to choose the DB, put another column in the CSV named "Database" in Row 1, then add -Database $_.Database to the example PowerShell line. This also doesn't specify the OU, which is something else you could add or just move them later.

Import-CSV: http://technet.microsoft.com/en-us/library/dd347665.aspx

New-Mailbox: http://technet.microsoft.com/en-us/library/aa997663.aspx

 
B

busbar



adding to Brian,

please check this link for further details:

http://www.exchangepedia.com/blog/2006/11/exchange-server-2007-bulk-creation-of.html

Regards, Mahmoud Magdy Watch Arabic Level 300 Videos about Exchange 2010 here: http://vimeo.com/user3271816 Read pretty advanced Exchange stuff I post here: http://www.enowconsulting.com/ese/blog.asp, follow my blog: http://autodiscover.wordpress.com , corp blog: http://ingazat.wordpress.com and if you Liked my post please mark it as helpful and accept it as an answer
 
Status
Not open for further replies.
Thread starter Similar threads Forum Replies Date
F Outlook 2016 bulk email from access Outlook VBA and Custom Forms 3
J 14 Steps To Building Your Bulk Emails So They Get Noticed New Slipstick.com Articles 0
makinmyway Bulk Delete Contacts in iOS Outlook App Using Outlook 4
Diane Poremsky Macro to Bulk Import Contacts and vCards into Outlook New Slipstick.com Articles 0
X Bulk edit Contact forms Using Outlook 2
Diane Poremsky Macro to Bulk Import vCards into Outlook New Slipstick.com Articles 0
M Bulk Edit contact notes BCM (Business Contact Manager) 1
Z bulk add categories / with fixed colours / select multiple categories on a not Using Outlook 1
R VB code to bulk save attachments deletes message Using Outlook 1
C Outllook Migration - Office 200? - 2010 - Shared Mailbox Export-Bulk 500 users Using Outlook 1
H Bulk import of PST files into Outlook Using Outlook 1
S Why Cant i send lots of emails from my hotmail in bulk? Using Outlook 1
F Text Format Change - Bulk Edit Contact Notes Using Outlook 2
P Viewing & Removing stats for bulk PST import Exchange Server Administration 2
Q Bulk but confidential mass mail in outlook? Using Outlook 2
D Need help bulk exporting mailboxes Exchange Server Administration 3
D Remove Contacts in bulk Exchange Server Administration 8
M sending bulk emails Using Outlook 1
O Copying Outlook Categories to the attachment (MS word) body in bulk. Is this possible? Using Outlook 7
M OWA (2003,2007,2010) How to enable or Disable efficiently in Bulk range Like Database/Storage Group/Server Exchange Server Administration 3
R New Relay for an application server to send bulk mail Exchange Server Administration 2
D Auto Replay Message For Bulk Users Exchange Server Administration 4
E Bulk changes in outlook contacts. Using Outlook 3
T Is there a way to bulk modify the alias field in a Exchange 2010 enviornment? Exchange Server Administration 2
M Custom message header; Precedence: Bulk Using Outlook 4
M received a bulk email in Outlook____ __ Using Outlook 1
D Pop ups when sending emails by bulk. Using Outlook 2
P Replying in bulk to all entries in an Inbox Using Outlook 1
D Bulk email blocking my outbox, and I cannot delete it Using Outlook 1
D Bulk email blocking my outbox, and I cannot delete it Using Outlook 1
S MS Outlook 2007 or 2010 - Save bulk emails as .msg to external destination Using Outlook 2
C Most new email is going into the Bulk Mail folder... Using Outlook 2
Q Outlook become non responsive if i write outlook item in bulk Outlook VBA and Custom Forms 20
R New Account creation Wizzard Using Outlook 1
JorgeDario How to restrict the creation of new folders? Outlook VBA and Custom Forms 2
M Email notification on creation of an appointment shared calendar? Outlook VBA and Custom Forms 3
K Different kind of issue related to creation of archive after one has been deleted Exchange Server Administration 1
wallisellener database creation failed BCM (Business Contact Manager) 0
G Email form/template creation Using Outlook 1
T Outlook 2003 free busy vfb file creation problem Using Outlook 12
M Send email on task creation? Using Outlook 2
D Exchange Server 2010 SP1 Hosted Mode, service@ mailbox creation Exchange Server Administration 1
L Restrict group creation in Outlook Using Outlook 4
S Help!Outlook , auto-configuration (creation exch. accounts) to exchange server??? Using Outlook 2
B Identify SMTP email submitted from IP or Application for rule creation? Exchange Server Administration 7
R Disable automatic creation of outlook 2010 contacts for recipients Using Outlook 5
E Re: Disable automatic creation of outlook 2010 contacts for recipients Exchange Server Administration 2
S Audit Mailbox Creation/Deletion Exchange Server Administration 5
A DAG creation with 3 server Exchange Server Administration 4
K Database creation unsuccessful Using Outlook 1
Similar threads


















































Top