How to Use Set-MailboxAutoReplyConfiguration in Powershell

How to Use Set-MailboxAutoReplyConfiguration in Powershell

If there's one thing administrators of organizations should know, it's that unlocking the power of automation within your Exchange Server environment can significantly enhance communication efficiency.

Today, we are going to learn how to set an automatic reply message using Set-MailboxAutoReplyConfiguration in PowerShell in four easy steps.

What is the Set-MailboxAutoReplyConfiguration Cmdlet?

The Set-MailboxAutoReplyConfiguration cmdlet is a PowerShell command used in Microsoft Exchange Server environments to configure automatic email replies for a specific mailbox.

This cmdlet enables administrators to define parameters such as the start and end times for the auto-reply period, the message content, and whether the auto-reply should be sent to external or internal senders.

The Set-MailboxAutoReplyConfiguration cmdlet allows for the easy management of auto-reply settings across multiple mailboxes, streamlining administrative tasks and ensuring consistent communication practices within the organization.

The syntax of Set-MailboxAutoReplyConfiguration is the following:

Set-MailboxAutoReplyConfiguration

[-Identity] <MailboxIdParameter>

[-AutoDeclineFutureRequestsWhenOOF <Boolean>]

[-AutoReplyState <OofState>]

[-Confirm]

[-CreateOOFEvent <Boolean>]

[-DeclineAllEventsForScheduledOOF <Boolean>]

[-DeclineEventsForScheduledOOF <Boolean>]

[-DeclineMeetingMessage <String>]

[-DomainController <Fqdn>]

[-EndTime <DateTime>]

[-EventsToDeleteIDs <String[]>]

[-ExternalAudience <ExternalAudience>]

[-ExternalMessage <String>]

[-IgnoreDefaultScope]

[-InternalMessage <String>]

[-OOFEventSubject <String>]

[-StartTime <DateTime>]

[-WhatIf]

[<CommonParameters>]

Here are some of the most important meanings of each of these parameters:

  • Identity: Specifies the mailbox for which auto-reply configuration is being set.
  • AutoDeclineFutureRequestsWhenOOF: Determines whether future meeting requests are automatically declined when out of office (OOF) is enabled.
  • AutoReplyState: Sets the out-of-office (OOF) state, whether it's enabled, disabled, or scheduled.
  • CreateOOFEvent: Specifies whether an out-of-office event is created on the calendar.
    DeclineAllEventsForScheduledOOF: Declines all events during a scheduled out-of-office period.
  • DeclineEventsForScheduledOOF: Declines only meeting events during a scheduled out-of-office period.
  • DeclineMeetingMessage: Specifies the message sent when meeting requests are declined.
  • DomainController: Specifies the domain controller to use for this operation.
  • EndTime: Sets the end time for the auto-reply period.
  • EventsToDeleteIDs: Specifies the IDs of events to delete during a scheduled out-of-office period.
  • ExternalAudience: Defines who receives the external auto-reply message.
  • ExternalMessage: Sets the message sent to external senders during the auto-reply period.
    IgnoreDefaultScope: Ignores the default scope for the Exchange Management Shell session.
  • InternalMessage: Sets the message sent to internal senders during the auto-reply period.
    OOFEventSubject: Sets the subject of the out-of-office event created on the calendar.
  • StartTime: Sets the start time for the auto-reply period.

What Can You Use the Set-MailboxAutoReplyConfiguration Command For?

The Set-MailboxAutoReplyConfiguration command in Microsoft Exchange Server is very versatile and useful - we can use it for the following purposes (among others):

  • Out-of-Office (OOF) Messages (Automated Replies): Administrators can use this command to configure automatic out-of-office messages for users who are temporarily away from their email. This ensures that senders are informed about the recipient's unavailability and can expect delayed responses.
  • Scheduled Absences: With Set-MailboxAutoReplyConfiguration, administrators can schedule auto-replies for specific time periods, such as vacations or business trips. This allows users to set their out-of-office messages in advance, ensuring uninterrupted communication during their absence.
  • Meeting Declines: Organizations can use this command to automatically decline meeting requests during a user's out-of-office period. This prevents users from inadvertently accepting meetings that conflict with their scheduled absence.
  • Customized Responses: Administrators can also customize auto-reply messages based on sender type, such as internal or external contacts. This enables users to provide tailored responses to different groups, enhancing communication effectiveness.
  • Event Management: The command facilitates event management by allowing administrators to specify events to delete or decline during an out-of-office period. This ensures that users' calendars accurately reflect their availability and commitments, reducing scheduling conflicts.

Prerequisites to Run the Set-Mailbox Auto Reply Configuration Cmdlet

Before using this command, active users need to comply with the following five prerequisites:

  1. Permissions: First, the user running the cmdlet needs to have appropriate permissions to modify mailbox settings. This requires membership in the "Recipient Management" or "Organization Management" role groups within Exchange.
  2. Exchange Server Version: The cmdlet is available in specific versions of Exchange Server. Make sure that the Exchange Server version being used supports the Set-MailboxAutoReplyConfiguration cmdlet.
  3. Authentication: Remember you'll need to authenticate with Exchange Server before executing the cmdlet. This involves providing credentials or having appropriate authentication mechanisms in place, depending on your organization's structure.
  4. Exchange Online (for Exchange Online Environments): If operating in Exchange Online (Office 365), ensure that you have the necessary permissions and access to Exchange Online PowerShell modules.
  5. Mailbox Availability: The cmdlet operates on individual mailboxes. Ensure that the mailbox targeted for configuration is available and accessible within the Exchange environment.

How to Use Set-MailboxAutoReplyConfiguration in PowerShell

Now that we understand how to use Set-MailboxAutoReplyConfiguration, it's time to get to work and start using it.

Step 1: Connect to Exchange Online PowerShell

The first step is to go PowerShell and enter the following command into the command box:

Connect-ExchangeOnline -UserPrincipalName [email protected]


Log into your organization’s environment using your Microsoft credentials, make sure you have all the necessary permissions to execute the command, and proceed to the next step.

Step 2: Run Get-MailboxAutoReplyConfiguration and Identify the Mailbox

Now, determine the identity of the mailbox for which you want to configure the auto-reply settings. You can specify the mailbox by its alias, display name, distinguished name, or email address.

Then, although not completely necessary, we suggest you run the Get-MailboxAutoReplyConfiguration cmdlet.

When executed, this cmdlet returns information such as the auto-reply message, schedule, and other relevant settings configured for a particular mailbox. Administrators commonly use it to view and manage auto-reply settings for Exchange mailboxes, and you can execute it to prevent any potential error message.

Step 3: Execute the Set-MailboxAutoReplyConfiguration Command

Now, use the Set-MailboxAutoReplyConfiguration cmdlet along with the necessary parameters to configure the auto-reply settings for the identified mailbox like in the following example:

Set-MailboxAutoReplyConfiguration -Identity [email protected] -AutoReplyState Scheduled -StartTime "7/12/2024 09:00:00" -EndTime "7/20/20204 19:00:00" -InternalMessage "Internal auto-reply message"

The output of this command configures Automatic Replies for James's mailbox to be sent between the specified start and end dates and includes an internal reply.

Wrapping Up: Using Set-MailboxAutoReplyConfiguration

Mastering the Set-MailboxAutoReplyConfiguration cmdlet in PowerShell gives you a streamlined way to manage email communication within your Exchange Server environment.

By harnessing the command's capabilities, you can effortlessly configure auto-reply settings, schedule out-of-office messages, and customize responses to perfectly fit your organizational requirements.