共用方式為


Bulk-editing resource mailboxes with Powershell

This post is the result of an internal question specifically relating to bulk-editing resource mailboxes.  When you create resource mailboxes in Exchange 2007, you have the ability to specify an additional custom response that will be generated when they respond to meeting requests.

The question came of how to bulk edit the response that mailboxes generate based on the location (building) where they were located.

Fortunatey, this is fairly easy to do with Powershell.  I'm not proficient enough with writing Powershell scripts yet to figure out how to do that, but I was able to figure out how to run a one-liner Powershell command to do this.

The key here is that you need a searchable attribute.  Below, I've included 2 examples.  The first example uses the attribute IsResource, which will show up as an attribute on each mailbox.  It is set to either True or False (indicating whether the mailbox is a resource mailbox or not). 

Get-mailbox |where {$_.isresource –eq “True”} | Set-MailboxCalendarSettings –AddAdditionalResponse:$True –AdditionalResponse “Insert your message here”

In the above string, we are telling Powershell to get mailboxes, then we are passing a filter string telling it to get mailboxes where the attribute IsResource is set to True.  Next, we pipe the output of that command to the set-mailboxcalendarsettings cmdlet and change two settings.  First, we enable the addadditionalresponse attribute, which can have a value of True or Fales, then we set the additional response with a text field.  For those of you that are HTML-inclined, you can also insert HTML code into this field.  This will then modify the additional response for every mailbox that is set as a resource.

The second example uses a different attribute - that of the Office.  AS you can see, just about any attribute can be used here to refine your filter.

Get-mailbox |where {$_.Office –eq "Building 48”} | Set-MailboxCalendarSettings –AddAdditionalResponse:$True –AdditionalResponse “Insert your message here”

If you are proficient at Powershell scripting, you could easily write a script that searches for mailboxes in different offices, and generates a different response for different offices, but I haven't gotten there yet :-)