≡ Menu

How to Generate an Exchange 2010 Room List Report with PowerShell

If you work in an campus type of environment, where you have conference rooms spread out across multiple buildings or physical sites, you may have heard of the Room Finder functionality introduced with Exchange 2010 and Outlook 2010. The Room Finder allows users to easily locate a room resource when scheduling a meeting in Outlook. Instead of users having to scroll through the Global Address List (GAL) or try to guess which room resources are located in a particular location, they can select the appropriate room list, and see all of the available rooms. Take a look at this screen shot to see this in action:

Room lists are essentially just a special type of Distribution Group in Exchange. To populate the room list, you simply add one or more resource mailboxes to the group. After you’ve defined several room lists, you’ll probably get to the point where you need to generate a report listing all of the room lists and their associated resource mailboxes. The key to generating a report is to simply query the members of each distribution group that are designated as a room list. Take a look at the following code:

foreach($roomlist in Get-DistributionGroup -RecipientTypeDetails RoomList) {
  $roomlistname = $roomlist.DisplayName
  Get-DistributionGroupMember $roomlist.alias | 
    Select-Object @{n="Room List";e={$roomlistname}},
                  @{n="Room";e={$_.DisplayName}}    
}

In a perfect world this code would be more elegant and make better use of the pipeline, but the foreach loop is used here as a workaround. Notice that as we iterate over each group, where retrieving the list of members using the Get-DistributionGroupMember cmdlet. When then pipe the output to Select-Object, where we use calculated properties to build a custom object:

This is good for reviewing the room lists members interactively, but in most cases you’ll need to output this to an external file. We can do this by making a simple adjustment to our previous example. Simply save the output to a variable, and use that as your InputObject with Export-CSV, Out-File, etc.

$rooms = foreach($roomlist in Get-DistributionGroup -RecipientTypeDetails RoomList) {
  $roomlistname = $roomlist.DisplayName
  Get-DistributionGroupMember $roomlist.alias | 
    Select-Object @{n="Room List";e={$roomlistname}},
                  @{n="Room";e={$_.DisplayName}}    
}

Export-Csv -InputObject $rooms -Path C:\rooms.csv -NoTypeInformation

After running the above code, you could open up the rooms.csv file in Excel and use the Filter feature to easily view the rooms associated with each list. For more details on the Room Finder, check out this post on the Exchange Team blog.

2 comments… add one

Leave a Comment