Using new-MailboxRepairRequest in Powershell

If you've dealt with inconsistent folder views, broken search functionality, or calendar glitches, today you will learn how a single cmdlet allows you to target and fix those problems directly.

The New-MailboxRepairRequest cmdlet in Microsoft Exchange is a valuable tool for administrators responsible for keeping mailboxes healthy and free of corruption. This command is versatile enough to be used on individual mailboxes or entire databases, giving you control over how to approach repairs based on the scale of the issue.

In this article, we’ll explore how to use New-MailboxRepairRequest effectively, covering everything from key use cases to detailed steps for implementation.

What is the New-MailboxRepairRequest Command in PowerShell?

The New-MailboxRepairRequest cmdlet in Microsoft Exchange Server is a command designed to help administrators detect and repair corruption issues within mailboxes or databases. This tool is particularly useful for resolving problems like corrupted search folders, provisioned folders, and inconsistencies in views or item counts that can cause user experience issues.

The cmdlet allows you to target either individual mailboxes or an entire database, making it flexible depending on the scope of the problem. It runs repair tasks in the background, ensuring the mailbox remains functional while issues are being addressed.

Here’s the syntax of New-MailboxRepairRequest, along with brief explanations for each parameter you need to know:

New-MailboxRepairRequest
[-Database] <DatabaseIdParameter>
-CorruptionType <MailboxStoreCorruptionType[]>
[[-StoreMailbox] <StoreMailboxIdParameter>]
[-Confirm]
[-DetectOnly]
[-DomainController <Fqdn>]
[-Force]
[-WhatIf]
[<CommonParameters>]

  • -Database <DatabaseIdParameter>: Specifies the mailbox database to target for the repair request.
  • -CorruptionType <MailboxStoreCorruptionType>: Defines the types of corruption to detect and repair, such as folder views, search folders, or provisioned folders.
  • -StoreMailbox <StoreMailboxIdParameter>: Identifies a specific mailbox within the database to target for the repair, if you are not repairing the entire database.
  • -Confirm: Prompts for confirmation before executing the repair request.
  • -DetectOnly: Runs the command to detect corruption issues without performing any repairs.
  • -DomainController <Fqdn>: Specifies the fully qualified domain name (FQDN) of the domain controller to be used for the operation.
  • -Force: Forces the operation to run without any additional confirmation or prompts.
  • -WhatIf: Simulates the command, showing what would happen without making any actual changes.
  • <CommonParameters>: Refers to the standard parameters like -Verbose, -Debug, -ErrorAction, etc., that are available in most PowerShell cmdlets.

3 Use Cases for the New-Mailbox Repair Request Cmdlet

The New-MailboxRepairRequest cmdlet is useful in several practical scenarios where mailbox data integrity may be compromised. Let’s take a look at 3 use cases:

  1. Fixing Corrupted Mailbox Items: If users are experiencing issues like missing emails, folders not displaying correctly, or search results that aren’t accurate, this cmdlet can be run to detect and repair those specific mailbox problems.
  2. Resolving Calendar Issues: Calendar data can sometimes get out of sync, leading to problems like duplicate entries, incorrect meeting times, or disappearing appointments. By running the cmdlet with a focus on calendar folders, you can clean up these issues, ensuring that the user’s calendar is reliable and accurate.
  3. Database-Level Repairs: For larger environments, database corruption can cause multiple mailboxes to behave inconsistently. Running the cmdlet on an entire mailbox database scans for and repairs structural issues across all mailboxes, preventing widespread problems before they affect users.

Prerequisites to Use the New-MailboxRepairRequest Command

To use the New-MailboxRepairRequest cmdlet successfully, you need to comply with 4 key prerequisites:

  1. Permissions: First, you need the appropriate permissions assigned to your role within Exchange to run this cmdlet. Not all parameters might be available if your permissions are limited, so it’s important to verify that you have the required access. You can check what permissions are needed for this cmdlet on the official Microsoft website.
  2. Database Access: For database-level repairs, make sure that only one repair request is active per server to avoid performance issues. You can run up to 100 concurrent mailbox-level repairs, but exceeding these limits could impact system performance.
  3. Planned Maintenance Window: Since the repair process can temporarily disrupt access to the mailbox being worked on, it’s best to schedule this task during off-peak hours or in a planned maintenance window to minimize user disruption.
  4. Understanding the Non-Reversible Nature: Once a repair request is initiated, it cannot be stopped unless the entire database is dismounted. Be prepared for the repair process to run to completion, as this could involve some downtime if database dismounting is required.

How to Use New-MailboxRepairRequest in 3 Steps

Now, let’s learn how to use New-MailboxRepairRequest in PowerShell by following 3 easy steps.

Step 1: Connect to Exchange Server

As always, before using this command, you need to establish a connection to the Exchange Management Shell (for on-premises) or Exchange Online PowerShell (for cloud environments). To do this, open PowerShell as an administrator, and run the following command:

Connect-ExchangeOnline -UserPrincipalName youremail@meetingroom365.com


After running this command, enter your credentials when prompted. This connects your session to the Exchange Online environment so we can get started.

Step 2: Run the New-MailboxRepairRequest on a Mailbox or Database

Once connected, decide whether you need to repair a single mailbox or an entire database.
For instance, if a user reports issues like corrupted folders or missing items, use this command:

New-MailboxRepairRequest -Mailbox "james@meetingroom365.com" -CorruptionType SearchFolder, AggregateCounts, ProvisionedFolder, FolderView

This command initiates a repair request on the specified mailbox to fix issues related to search folders, aggregate counts, provisioned folders, and folder views in Microsoft Exchange.

On the other hand, if you need to scan and repair all mailboxes within a database, you can follow the next example:

New-MailboxRepairRequest -Database "MeetingRoom365 EmailDatabase" -CorruptionType ProvisionedFolder, FolderView


In this case, this command initiates a repair request on the specified database named "MeetingRoom365 EmailDatabase" to fix issues related to provisioned folders and folder views.

Step 3: Monitor and Manage the Repair Process

The repair process might take a while. While the repair process is in place, you need to remember that mailbox access will be temporarily disrupted for the specific mailbox being repaired. For database repairs, only one request is allowed per server at a time.

Then, to check the repair status or if it has been completed, use the Get-MailboxRepairRequest cmdlet like this:

Get-MailboxRepairRequest



This command provides details on any ongoing or recently completed repair requests, allowing you to monitor the process and confirm the repair was successful.

And that’s how you do it! By allowing administrators to identify and resolve corruption issues proactively, New-MailboxRepairRequest ensures smoother operations and a better user experience.

Whether fixing a single mailbox or handling database-wide problems, knowing when and how to use this cmdlet can save time, reduce downtime, and prevent small issues from becoming larger ones.