Just when you thought it couldn’t get more awesome.
By popular request, I have added a few new features (and fixed an annoyance). First, the bug fix:
Yes, it’s true. If you ran the Create-LabUsers script with -Count 1 with the -InflateMailboxes parameter, you’d run into an issue because of how I calculated the $MaxRecipients value. Since I didn’t want to totally crush the messaging system, I had elected to set $MaxRecipients to the maximum number of mailbox users / 3. However, for -Count parameters of 1, this would cause an error with a Get-Random cmdlet, since you couldn’t exactly find a random integer between 1 and 1. It was definitely an oversight on my part–I never imagined that someone would use a bulk user tool to create just one user.
Now, on to the new stuff!
Middle Name support
Along with pointing out my -Count oops, Darryl also had an idea for populating the AD middle name. I had originally just populated the middle initial. This was easy enough, using the first names seed data ($MiddleName = $Names.First[(Get-Random -Minimum 0 -Maximum $Names.First.Count)]) and then setting $MiddleIntial = $MiddleName.
I might as well call this update the Darryl Chronicle, since this was also one of his requests. As part of this update, I added a switch to allow you to create Exchange resource mailboxes:
- Shared Mailboxes: Random number of shared mailboxes assigned per-department, per location
- Equipment Mailboxes: Each location receives a fixed number (laptops and projectors)
- Room Mailboxes: Each location receives a fixed number with varying room capacities
- Room Lists: After creating the room mailboxes, the script will now create per-location room lists (special distribution lists that contain room objects for use with the Room Finder)
The latest version of the script is available on the Technet Gallery at http://aka.ms/createlabusers.