add_rooms.ps1

#
# add_rooms.ps1
#
# Written by Carol Wapshere, September 2008
#
# Use to create one or more room accounts, which are created disabled, and must be
# managed by other users.
#
# Instructions:
#
#   1. Modify the add_rooms.csv file to include information about the accounts to add.
#      The file must have a header row and must include the following fields:
#            dn,UID,displayName,surname,givenName,password,alias,description,UPN
#
#   2. Open the Exchange Management Shell
#
#   3. CD to C:\scripts and run add_rooms.ps1.
cat add_rooms.csv > unicode.csv # make utf8
import-csv unicode.csv | foreach {
write-host $_.displayName
$secureString = ConvertTo-SecureString $_.password -AsPlainText –Force
New-Mailbox -Room -Name $_.displayName -displayName $_.displayName -Alias $_.alias -OrganizationalUnit 'bbhfgg.local/BBH/Users' -UserPrincipalName $_.UPN -SamAccountName $_.UID -FirstName $_.givenName -Initials '' -LastName $_.surname -Database 'MEXBBH01\First Storage Group\Mailbox Database' -password $secureString -ResetPasswordOnNextLogon $false
} | out-file -filepath "c:\scripts\add_rooms.log" -encoding "UNICODE"