How do I script the creation of resource mailboxes/users from a list?

AD Server: Microsoft Windows Server 2003
Mail Server: Exchange Server 2007

I have a list of about 60 conference & training rooms that I need to import into AD/Exchange.  

I would like to script as much of this as possible.  Creation of the disabled user, name, email, password, creation of the resource mailbox, room or equipment, auto accept, capacity, AV/TV/Whiteboard, etc...

Thanks for your time in advance!
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.

This article is a good primer to using PowerShell cmdlets to create mailboxes in bulk.

And here is an example set of cmdlets I use to create Resource mailboxes from a CSV file containing the attribute values:

$Password=Read-Host "Enter Password" -AsSecureString

Import-CSV im_Resources.csv | foreach {New-Mailbox -Shared -Name $_.displayName -SamAccountName $_.sAMAccountName -Alias $_.mailNickName -UserPrincipalName $_.mail -database "SERVERNAME\Mailbox Database" -org '' -Password $Password}

Open in new window


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
kblumenAuthor Commented:
Thank you.  
This helps but I cannot seem to figure out how to include custom properties in the CSV/script.  So if my Conference Room has a (ceiling mounted) LCD projector I want the custom property to exist in my CSV/script.

I checked but I cannot figure out which would apply for a custom property.  

Also, what if 10 rooms do not have a custom property, 20 rooms have 2 custom properties and the rest had 3 custom properties?
In the CSV import file you would include a column for every attribute you want to import, but objects without values in those would simply be left blank.  This is most easily managed in Excel and then when you save the file in CSV format you'd see repeated commas indicating there is no data in that field to import.

I'm not sure if the CustomAttribute fields are supported by the New-Mailbox cmdlet.  You might need to create the accounts first and then use a different cmdlet or LDIFDE approach to populate the other data after the account is created.
Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

kblumenAuthor Commented:
In the initial link you provided (down in the comments) the author replies to a user asking the same thing:

"The last paragraph in the post has a link to Microsoft's online documentation for new-mailbox command, which lists all the parameters that you can add. The list includes custom attributes as well as plenty of others."

Do you know what they might be called or do you think he misspoke?

The raw AD attrbiute names are extensionAttribute1 through extensionAttribute15.
kblumenAuthor Commented:
I am speaking more along the lines of a Mailbox Property.  

So Jeff would you say it is only in the Set-Mailbox cmdlet (
This for example?
 [-ResourceCustom <MultiValuedProperty>]

Would you know how to pass the results of a Get-Mailbox to the Set-Mailbox?
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

From novice to tech pro — start learning today.