Posted by Dave Thijssen Sunday 2 March 2014

Besides regular mailboxes Exchange has the option of flagging mailboxes as a Room or Equipment mailbox. These so called Resource mailboxes can be added to an appointment by which users can use Outlook as a reservation system for conference rooms and video projectors.

To convert regular mailboxes that are used in this manner in an existing environment to Resource mailboxes can be time-consuming. Therefore I wrote a PowerShell script that sets the flag based on the occurence of certain words in the name of the mailbox. This script asumes your shared/resource mailboxes are in their own organizational unit.

Shared mailboxes have the added benefit of not requiring a license in Office 365 as they are represented by a disabled user account. One of the conditions however is that their size remains below 10 gigabytes and it is not possible to use ActiveSync with such accounts.

On to the script. First enable remote PowerShell to your Exchange server for the script session.

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://<FQDN of Exchange Server>/PowerShell/ -Authentication Kerberos
Import-PSSession $Session

Next declare this simple function to search the name for the occurence of a list of search terms.

function inArray([String]$searchTerm, [Array]$searchArray) {
    ForEach($term in $searchArray) {
        if ($searchTerm -match $term) {
            return $true
        }
    }
    return $false
}

Define the search terms (substrings that are part of the mailbox name) that would define it as a Room or Equipment mailbox.

In this case the terms are in Dutch, but you can replace these with for example: "room", "office", "floor" and so on.

$roomSearchTerms = "ruimte", "kamer", "zaal", "kantoor", "lokaal", "cabine"
$equipmentSearchTerms = "projector", "beamer", "laptop"

Define the OU wherein your shared mailboxes reside.

$organizationalUnit = "OU=Mail,OU=Groups,DC=domain,DC=local"

Finally the query and operations for each mailbox happen here.

$mailboxes = Get-Mailbox -OrganizationalUnit $organizationalUnit -ResultSize Unlimited

ForEach ($mailbox in $mailboxes) {
    if (inArray ($mailbox.Name) $roomSearchTerms) {
        Set-Mailbox -Identity $mailbox.WindowsEmailAddress -Type Room
    } elseif (inArray ($mailbox.Name) $equipmentSearchTerms) {
        Set-Mailbox -Identity $mailbox.WindowsEmailAddress -Type Equipment
    } else {
        Set-Mailbox -Identity $mailbox.WindowsEmailAddress -Type Shared
    }
}

The end result in the Address Book after running the script looks something like this:

Outlook 2013 All Rooms
Great succes! Modify and use at your own risk.

Download the script: setResourceMailboxes.ps1

Leave a comment

Join the conversation.

Copyright Dave Thijssen. Powered by Blogger.