-->

Saturday, April 7, 2018

Exchange - Set Resource Mailbox Calendaring Back To Defaults

If you follow my blog, you know that my company does some wacky (stupid) things with Resource Mailbox booking settings. They want calendars to function like Notes (which I migrated them over to Exchange from) and instead of letting Exchange manage calendars, we end up changing things that don't follow best or even sane practice.
Most of the time, they end up asking me to revert those settings. The problem is: I've changed so many settings over the months, I can't remember every thing that I was asked to set.
It'd be nice if there was a Set-RoomBackToDefault cmdlet, but there's not. So I cooked up a quick-and-dirty script that will set all settings on a Resource Mailbox back to default. This will save you time from deleting and re-creating the Mailbox!

Here's some settings that I've been asked to set. This is just an example, but it sets the Room to allow me (the delegate) to book without requiring myself to accept/decline my own meetings, but requires all other users to book through me; allows conflicts; allows the subject; and allows text in the body (comments).

Set-Calendarprocessing "test room" -AllowConflicts $true -DeleteComments $false -AddOrganizerToSubject $false -DeleteSubject $false -AllBookInPolicy $false -AllRequestOutOfPolicy $false -AllRequestInPolicy $true -BookInPolicy "stacey branham" -ResourceDelegates "Stacey Branham"

Get-CalendarProcessing "test room" | fl

AutomateProcessing                            : AutoAccept
AllowConflicts                                     : True
BookingWindowInDays                      : 180
MaximumDurationInMinutes              : 1440
AllowRecurringMeetings                     : True
EnforceSchedulingHorizon                  : True
ScheduleOnlyDuringWorkHours         : False
ConflictPercentageAllowed                  : 0
MaximumConflictInstances                  : 0
ForwardRequestsToDelegates               : True
DeleteAttachments                                 : True
DeleteComments                                    : False
RemovePrivateProperty                         : True
DeleteSubject                                         : False
AddOrganizerToSubject                        : False
DeleteNonCalendarItems                       : True
TentativePendingApproval                    : True
EnableResponseDetails                          : True
OrganizerInfo                                         : True
ResourceDelegates                                 : {exchangeitup.com/Users/staceybranham}
RequestOutOfPolicy                              : {}
AllRequestOutOfPolicy                         : False
BookInPolicy                                          : {/o=exchangeitup/ou=Exchange Administrative Group
(FYDIBOHF23SPDLT)/cn=Recipients/cn=026f8db5e35544e082e8c123cf9c190f- staceybranham}
AllBookInPolicy                                    : False
RequestInPolicy                                     : {}
AllRequestInPolicy                                : True
AddAdditionalResponse                        : False
AdditionalResponse                               :
RemoveOldMeetingMessages               : True
AddNewRequestsTentatively                : True
ProcessExternalMeetingMessages         : False
RemoveForwardedMeetingNotifications : False
ObjectState                                              : Changed


I created the following script to ask you to provide a Resource Mailbox name (this way you don't have to edit the script itself every time you run it), then it will run against that Resource Mailbox and set all settings to default according to this MS TechNet Article.
This basically saves you from typing all the switches mentioned in the above article, manually ;)

You can grab the script from my Google Drive here

-or-

Copy and paste the following block into Notepad, and save as Set-Calendar-Defaults.ps1

$name = Read-host "Enter a Resource Mailbox Name"
Set-CalendarProcessing -Identity $name -AddAdditionalResponse $false -AddNewRequestsTentatively $true -AddOrganizerToSubject $true -AllBookInPolicy $true -AllowConflicts $false -AllowRecurringMeetings $true -AllRequestInPolicy $false -AllRequestOutOfPolicy $false -AutomateProcessing AutoAccept -BookingWindowInDays 180  -BookInPolicy $null -ConflictPercentageAllowed 0 -DeleteAttachments $true -DeleteComments $true -DeleteNonCalendarItems $true -DeleteSubject $true -EnableResponseDetails $true -EnforceSchedulingHorizon $true -ForwardRequestsToDelegates $true -MaximumConflictInstances 0 -MaximumDurationInMinutes 1440  -OrganizerInfo $true -ProcessExternalMeetingMessages $false -RemoveForwardedMeetingNotifications $false -RemoveOldMeetingMessages $true -RemovePrivateProperty $true -RequestInPolicy $null -RequestOutOfPolicy $null -ResourceDelegates $null -ScheduleOnlyDuringWorkHours $false -TentativePendingApproval $true; Get-CalendarProcessing -Identity $name | FL


Once you have the .ps1 saved, fire up the Exchange Management Shell (EMS) and run Set-Calendar-Defaults.ps1

You will prompted to input a Resource Mailbox:

EMS Set Calendar Defaults

Enter the mailbox name (it doesn't need quotes around it) and the script will fire off.

After the script sets the defaults, it will then automatically run the Get-CalendarProcessing cmdlet on the mailbox you ran the script against to show that the revert-to-default was successful:

AutomateProcessing                         : AutoAccept
AllowConflicts                                  : False
BookingWindowInDays                    : 180
MaximumDurationInMinutes            : 1440
AllowRecurringMeetings                   : True
EnforceSchedulingHorizon                : True
ScheduleOnlyDuringWorkHours       : False
ConflictPercentageAllowed                : 0
MaximumConflictInstances                : 0
ForwardRequestsToDelegates             : True
DeleteAttachments                              : True
DeleteComments                                 : True
RemovePrivateProperty                       : True
DeleteSubject                                       : True
AddOrganizerToSubject                      : True
DeleteNonCalendarItems                     : True
TentativePendingApproval                  : True
EnableResponseDetails                        : True
OrganizerInfo                                       : True
ResourceDelegates                               : {}
RequestOutOfPolicy                            : {}
AllRequestOutOfPolicy                       : False
BookInPolicy                                       : {}
AllBookInPolicy                                  : True
RequestInPolicy                                   : {}
AllRequestInPolicy                              : False
AddAdditionalResponse                      : False
AdditionalResponse                             :
RemoveOldMeetingMessages             : True
AddNewRequestsTentatively              : True
ProcessExternalMeetingMessages      : False
RemoveForwardedMeetingNotifications : False
ObjectState                                          : Changed


Now, all settings are back to the way they were when you first created the mailbox; and surprise surprise, it works pretty well out-of-the-box...tell your users that!

No comments:

Post a Comment