Convert and configure Exchange 2007 conference room mailbox

Having recently migrated all of our department to Exchange 2007, we were excited to take advantage of the new conference room functionality! No more Outlook Resource configuration, no more faulty Auto-Accept script! Microsoft has FINALLY programmed in full-fledged resource mailbox functionality into Exchange.

Our dilemna. After migration from Exchange 2003, our resource mailboxes were showing up in the Exchange Management console as LinkedMailbox type.

get-mailbox "resource mailbox" | select RecipientTypeDetails

To convert them to UserMailbox type, Microsoft informed us that we'd need to disconnect the mailbox (from the AD account, then reconnect it. Afterwards, we can run the powershell cmdlet to assign the conference room calendar settings.

Sounds easy enough.

Disable-Mailbox -identity "Resource Mailbox"
Connect-Mailbox -identity "Resource Mailbox" -database (it's db) -user "domain\rsrmbxacct"

Right?? Nope.

  1. To connect a domain account to a mailbox, the account needs to be enabled. We've disabled all our resource accounts.
  2. When you enable an account, it needs to have a valid password based on your security standards.
  3. You have to wait for replication, which may not be immediately.

My following code, will read a straight list of mailbox names, and convert them from LinkedMailbox type mailboxes, to RoomMailbox type, then configure it as a conference room based on the following criteria.

cls
#The following file contains list of mailbox display names, seperated by a carriage return.
$Rooms = Get-Content -path ".\AllConferenceRooms.txt"

#Set this variable to $true for normal conference rooms
#set this variable to $false for director conference rooms
#---------------------------
$NormalCRoom = $True
$Delegates = @("delegate1@example.com","delegate2@example.com")

#If this will be a 'director-type' conference room.
if ($NormalCRoom -eq $False){
$Delegates += "Delegate3@example.com"
}

foreach ($MyMailbox in $Rooms) {
        $MyMailbox = $MyMailbox.Trim()
       
       
        if (($MyMailbox -ne $null) -and ($mymailbox -ne '')){
                #Gathering some information
                #---------------------------
                $Mbx = get-mailbox $MyMailbox
                $MyMailbox = $Mbx.DisplayName
                "Working on '" + $MyMailbox + "'"
                "-------------------------------------"

                $mbxUPN = $mbx.UserPrincipalName
                $DB = $Mbx | select database| % {Get-MailboxDatabase -Identity $_.database}

                if ($Mbx.RecipientTypeDetails -eq "LinkedMailbox") {
                        "Linked mailbox - converting to UserMailbox"
                        Disable-mailbox $MyMailbox -erroraction stop -outvariable Result

                        #Pausing script while waiting for the Disable-Mailbox command to process.
                        do {
                                $isDisabled = get-user -identity $mbxUPN
                        } while ( $isDisabled.recipienttype -eq "UserMailbox")

                        #Create a new password for the account based on the UPN field.
                        "Setting account password to :'"+$mbxUPN + "'"
                        $pwd = new-object Security.SecureString
                        $mbxUPN.ToCharArray() | foreach { $pwd.AppendChar($_)}
                        Set-QADUser -Identity $mbxUPN -UserPassword $pwd

                        "Reconnecting mailbox to domain account"
                        ## found I needed to enble the AD account to get next step to work.
                        enable-qaduser -identity $mbxUPN
                        Connect-mailbox -identity $MyMailbox -database $DB -user $mbxUPN
                        disable-qaduser -identity $mbxUPN

                        #Pausing script to wait for AD replication
                        do {
                                $isDisabled = get-user -identity $mbxUPN
                        } while ( $isDisabled.recipienttype -ne "UserMailbox")
                        $Mbx = get-mailbox $MyMailbox
                }

                #Convert standard mailbox to conference room resource
                if ($Mbx.RecipientTypeDetails -eq "UserMailbox") {
                        "Converting to Conference Room mailbox"
                        Set-Mailbox -identity $MyMailbox -Type room
                       
                        do {
                                $isDisabled = get-user -identity $mbxUPN
                        } while ( $isDisabled.RecipientTypeDetails -ne "RoomMailbox")
                        $Mbx = get-mailbox $MyMailbox
                }

                #configure conference room.
                if ($Mbx.RecipientTypeDetails -eq "RoomMailbox") {
                        if ($NormalCRoom -eq $true) {
                                "Configuring the conference room to auto accept meeting requests"
                                Set-MailboxCalendarSettings -Identity $MyMailbox -AddOrganizerToSubject $true -AllBookInPolicy $true -AllowConflicts $false -AllowRecurringMeetings $true -AutomateProcessing AutoAccept -BookingWindowInDays 366 -Confirm -DeleteAttachments $true -DeleteComments $true -DeleteNonCalendarItems $true -DisableReminders $true -EnableResponseDetails $true -EnforceSchedulingHorizon $true -MaximumDurationInMinutes 720 -AddAdditionalResponse $false -OrganizerInfo $true -RemoveForwardedMeetingNotifications $true -RemoveOldMeetingMessages $true -RemovePrivateProperty $true
                        } else {
                                "Configuring the conference room to as a 'Director-type' mailbox"
                               
                                Set-MailboxCalendarSettings -Identity $MyMailbox -AddOrganizerToSubject $true -AllBookInPolicy $false -AllowConflicts $false -AllowRecurringMeetings $true -AutomateProcessing AutoAccept -BookingWindowInDays 366 -Confirm -DeleteAttachments $true -DeleteComments $true -DeleteNonCalendarItems $true -DisableReminders $true -EnableResponseDetails $true -EnforceSchedulingHorizon $true -MaximumDurationInMinutes 720 -AddAdditionalResponse $false -OrganizerInfo $true -RemoveForwardedMeetingNotifications $true -RemoveOldMeetingMessages $true -RemovePrivateProperty $true -AllRequestInPolicy $true -ForwardRequestsToDelegates $true
                        }

                        foreach ($Person in $Delegates) {
                                "Assigning "+$Person + " mailbox rights on this resource"
                                Add-MailboxPermission -AccessRights FullAccess -Identity $MyMailbox -User $Person
                        }


                        "Assiging "+$delegates + " as Delegates to this resource."
                        Set-MailboxCalendarSettings -Identity $MyMailbox -ResourceDelegates $Delegates
                }

                "Completed."
                " "
                " "
        }
}