Creating Mailboxes in Bulk using the CSV Parser Script in Outlook Live

The first thing many new Outlook Live customers want to do is create a bunch of accounts. I recommend you use dummy account names for this until you are ready to use your real data. I even go as far as to recommend running one of more parallel Outlook Live tenants purely for testing purposes.

Microsoft has provided a script for administrators to use to create and manage many Mailboxes/MailUsers/MailContacts. You can download this script (called CSV_Parser_RS.ps1) from http://connect.microsoft.com/ site and by registering for the Outlook Live ‘Connection’. You can use your admin account for your Outlook Live tenant to do this. The script changes every so often so keep checking back for the latest updates.

This CSV_Parser_R3.ps1 script works with a Comma Separate Values file (CSV) which is basically a text file with a .csv filename extension. You can work with csv files in Notepad if you like… others prefer to use a spreadsheet for the sake of their sanity.

http://silverlight.services.live.com/invoke/71782/createaccountsusingPowerShell/iframe.html

Download

Rather than go through all of the variations of what you can create in your CSV file, I would recommend consulting http://help.outlook.com on the topic; only the basics will be covered here, but I will revisit this topic from time to time. What you see used above is a typical selection of fields to use to start some account creation testing.

Using the CSV Parser Script in PowerShell

The syntax for using this script looks a lot like you are creating a PowerShell Session. This is because the script needs to know about many of the same parameters as it executes. The script does all of the session creation and removal for you, so you do not have to worry about that. Session removal is the last thing that happens… if however for any reason you terminate the script before it completes, please ensure to remove the runspace the script created. Remember, you can remove all sessions by typing:

Get-PSSession | Remove-PSSession

Steps are as follows… I will assume that you place this script and your csv file into “C:\Parser”. You can obviously put the files somewhere else if you like…just remember to change the paths and filenames.

# capture the admin LiveID username in a variable
$Cred = get-credential

# run the script
C:\Parser\CSV_Parser_R3.PS1 -UsersFile C:\Parser\test.csv -LiveCredential $Cred -LogDirectory C:\Parser\ -ValidateAction $true

Some notes to consider on managing your mailboxes with CSV files…

As time goes on, you will likely find that you will need a number of csv files to maintain your accounts. Different administrators do this in different ways with csv files, but the following is fairly typical:

  • A Master CSV file is maintained that contains up to date information from whatever your ‘fountain of truth’ is for your student data. This could be a SIS like Banner. This file should reflect precisely what is on Outlook Live.
  • When new mailboxes are added, the record entries are added first to the master CSV file, and then created again in a separate ‘new mailboxes’ CSV file which contains all of the details for required new mailboxes in a set time period – e.g. 24 hours. This ‘new mailboxes’ CSV file is then processed with CSV Parser and then discarded or stored somewhere as a perpetual record of what happened on the date it was used.
  • When mailboxes are updated, the records are first updated in the master file and then the records are created again in a separate ‘mailbox updates’ CSV file which contains all of the details for required updates to mailboxes in a set time period – e.g. 24 hours. This ‘updates’ csv file is then processed with CSV Parser and then discarded or stored somewhere as a perpetual record of what happened on the date it was used.
  • When mailboxes are deleted, the records are first deleted from the master file and then the records are created again in a separate ‘mailbox deletes’ csv file which contains all of the details for required mailbox deletes in a set time period – e.g. 24 hours. This ‘mailbox deletes’ CSV file is then processed with CSV Parser and then discarded or stored somewhere as a perpetual record of what happened on the date it was used.
  • It is obviously a good idea to have some process around this… start creating mailboxes manually, and very quickly you will have a confusing mismatch between what you believe is in Outlook Live according to your Master CSV file, and what is actually in Outlook Live.

Enjoy!

Jonny

Advertisements

8 Responses to Creating Mailboxes in Bulk using the CSV Parser Script in Outlook Live

  1. Frank says:

    Jonny, great post! Really informative.

  2. Chris says:

    I bulk created some test users to Outlook Live R3 using the CSV_Parser script. When I use get-user to print out my test user\’s information all the attributes are filled in correct (first name, last name, …) but when I access the test account and click on profile outlook live always asks the user to input their name. Is this the correct behavior or am I just missing some attributes in my input csv.

  3. US LiveAtedu says:

    @ChrisI am unsure where exactly a user is being *asked* to fill in their name? Do you mean at first login or something? Please elaborate some more here…

  4. Chris says:

    My test user is asked to enter their first name and last name when the "Profile" link is clicked from the menu items at the top of the "Home" page. When the "Profile" link is clicked the user is taken to a required until provided page prompting the user to provide the required Profile details. I was assuming that the first name and last name populated with the mailbox would also be populated in the Profile. This is likely an erroneous assumption on my part and the Profile is a separate Live service not covered by CSV_Parser.

  5. US LiveAtedu says:

    @ChrisCorrect, this is your Live Profile… this is not the same as your mailbox profile. I can see where the confusion is though. Let me pass that feedback on.

  6. Chris says:

    I noticed some strange behavior when calling CSV_Parser from another powershell script. My script would always exit after running CSV_Parser and never execute any lines after the call to CSV Parser. I tracked it down to the logExit function using break rather than exit. That break appears to halt execution of the entire script. I did a quick pair of test scriptstest1.ps1 ./test2.ps1write-host "HERE2"test2.ps1write "HERE1"breakThis will only print HERE1 and cause the execution of both scripts to stopif you can the break to an exit then both HERE1 and HERE2 get printed

  7. Van says:

    I am getting this error when I try to update CustomAttribute fields on accounts[Error]: Mailbox update was unsuccessful. Error=Cannot remove Windows Live ID: "Van.Howell@chapmail.lcu.edu" from the list of EmailAddresses.I am not updating email addresses, I am only adding custom attributes to existing email boxes.Any Ideas?

  8. US LiveAtedu says:

    @VanYou need to include the EmailAddress field in an update… there is a bug in the script that we will fix soon. If you omit the EmailAddress, PowerShell/Exchange complains as it thinks you are trying to remove the email address entry that maps to the LiveID

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: