We use cookies to improve your experience.
By your continued use of this site you accept such use.
For more details please see our privacy policy and cookies policy.

Script Repository

Save mailbox calendar processing settings to Active Directory attribute

May 05, 2021 Views: 2523

The script saves calendar processing settings of a Microsoft 365 (Office 365) mailbox to a multi-valued Active Directory attribute. To run the script, create a scheduled task configured for the User object type.


  • $attributeName - Specifies the LDAP name of the multi-valued attribute to hold calendar processing settings.
  • $settingsMap - Maps names of the settings as returned by PowerShell and their respective display names as they should be displayed in Adaxes. Settings not included in this map will be ignored and will not be added to the AD attribute.
Edit Remove
$attributeName = "adm-CustomAttributeTextMultiValue1" # TODO: modify me
$settingsMap = @{
    "AutomateProcessing" = "Automate Processing Enabled";
    "AllowConflicts" = "Allow Conflicts";
    "BookingWindowInDays" = "Booking Window in Days";
    "AllowRecurringMeetings" = "Allow Recurring Meetings";
    "ScheduleOnlyDuringWorkHours" = "Schedule Meetings Only During Work-Hours";
    "OrganizerInfo" = "Organizer Info";
    "ResourceDelegates" = "Resource Delegates";
    "RemoveOldMeetingMessages" = "Remove Old Meeting Messages";
    "ProcessExternalMeetingMessages" = "ProcessExternalMeetingMessages";
    "RemoveForwardedMeetingNotifications" = "Remove Forwarded Meeting Notifications";
} # TODO: modify me. Example $settingsMap = @{ "<PropertyName>" = "<Property Display Name>"; }

# Get the object ID in Microsoft 365
    $objectId = [Guid]$Context.TargetObject.Get("adm-O365ObjectId")
    $Context.LogMessage("The user doesn't have a Microsoft 365 account", "Warning")

    # Connect to Exchange Online
    $session = $Context.CloudServices.CreateExchangeOnlinePSSession()
    Import-PSSession $session -AllowClobber -DisableNameChecking -CommandName "Get-CalendarProcessing"
    # Get calendar processing options
    $processingOptions = Get-CalendarProcessing -Identity $objectId.ToString()
    $values = @()
    foreach ($propertyName in $settingsMap.Keys)
        $values += "$propertyName`: " + ($processingOptions.$propertyName -join ",")
    # Save information to AD account
    $Context.TargetObject.Put($attributeName, $values)
    # Close the remote session and release resources
	if ($session) { Remove-PSSession $session }

Comments 0
Leave a comment

Got questions?

Support Questions & Answers