How to Use Get-RecoverableItems in Powershell

How to Use Get-RecoverableItems in Powershell

If you are in charge of business email management, then you know that recovering and managing important data in Exchange mailboxes is crucial.

Administrators face challenges such as accidental deletions, compliance rules, and user support needs. That's where PowerShell's Get-RecoverableItems cmdlet comes in, and we will show you how to use it in this quick guide.

What is Get-RecoverableItems Cmdlet in PowerShell?

The Get-RecoverableItems cmdlet in PowerShell is a command used within Microsoft Exchange Server environments to retrieve items that are recoverable from the mailbox database.

It's primarily used for accessing items such as deleted emails, contacts, calendar entries, tasks, and other objects that have been soft-deleted or moved to the dumpster. This cmdlet allows administrators or users with appropriate permissions to view and potentially recover these items.

The syntax of the Get-RecoverableItems command is the following:

Get-RecoverableItems

-Identity <GeneralMailboxOrMailUserIdParameter>

[-EntryID <String>]

[-FilterEndTime <DateTime>]

[-FilterItemType <String>]

[-FilterStartTime <DateTime>]

[-LastParentFolderID <String>]

[-ResultSize <Unlimited>]

[-SourceFolder <RecoverableItemsFolderType>]

[-SubjectContains <String>]

[<CommonParameters>]

Here's the meaning of each one of these parameters, which are all necessary for the proper functioning of the cmdlet:

  • Identity: Specifies the mailbox identity from which to retrieve recoverable items.
  • EntryID: Filters recoverable items based on the EntryID property.
  • FilterEndTime: Specifies the end time for filtering recoverable items.
  • FilterItemType: Filters recoverable items based on item type, such as email, calendar item, etc.
  • FilterStartTime: Specifies the start time for filtering recoverable items.
  • LastParentFolderID: Filters recoverable items based on the ID of the last parent folder.
  • ResultSize: Specifies the maximum number of results to return. By default, it returns an unlimited number of results.
  • SourceFolder: Specifies the folder type from which to retrieve recoverable items, such as the dumpster or the recoverable items folder.
  • SubjectContains: Filters recoverable items based on whether the subject contains a specific string.

What Can You Use the Get-RecoverableItems PowerShell Command For?

Despite looking like a simple cmdlet, the truth is that Get-RecoverableItems is a very versatile ally, allowing us to perform the following tasks (among others):

  • Data Recovery: Administrators can use Get-RecoverableItems to search for and retrieve specific items that users have accidentally deleted. This could include emails, contacts, calendar entries, or other important data that users need to access again.
  • User Support and Troubleshooting: When users report missing emails or other items, support teams can utilize Get-RecoverableItems to search for and recover those items on behalf of the users. This helps in troubleshooting and resolving issues related to data loss or accidental deletion, enhancing user productivity and satisfaction.
  • Policy Enforcement: Organizations may have specific retention policies in place to manage mailbox data. Administrators can use Get-RecoverableItems to ensure compliance with these policies by identifying items that should be retained or permanently deleted according to the organization's guidelines.

Get-RecoverableItems vs. Restore-RecoverableItems Cmdlet

Get-RecoverableItems and Restore-RecoverableItems are both cmdlets used in Microsoft Exchange Server environments, but they serve different purposes:

  • Get-RecoverableItems: This cmdlet is used to retrieve information about items that are recoverable within a mailbox database, providing insights into what items are available for potential recovery.
  • Restore-RecoverableItems: On the other hand, this cmdlet is used to restore recoverable items back to their original location within the mailbox. It allows administrators or users to recover items that were previously deleted or moved to the dumpster. By specifying the appropriate parameters, such as the identity of the item to restore, administrators can effectively recover important data for users.

So, we can say that Get-RecoverableItems is for retrieving information about recoverable items, while Restore-RecoverableItems is for actually restoring those items back into the mailbox.

They complement each other in the process of managing and recovering data within Exchange Server environments, so using them both might be necessary in different scenarios.

Prerequisites to Run the PowerShell Cmdlet Get-RecoverableItems

Although Get-RecoverableItems is a quite simple-to-use cmdlet, it is still important to comply with the following three prerequisites before running this command:

  1. Permissions: You need to have appropriate permissions to access and retrieve recoverable items from Exchange mailboxes. This requires membership in the appropriate Exchange role group, such as the Mailbox Import Export role group or being assigned specific permissions to access and manage recoverable items.
  2. Exchange Environment: The cmdlet is specific to Microsoft Exchange Server environments. Therefore, you need access to an Exchange Server environment where the cmdlet can be executed.
  3. Correct Syntax and Parameters: Familiarize yourself with the correct syntax and parameters of the Get-RecoverableItems cmdlet. Make sure that you provide the necessary parameters, such as the identity of the mailbox from which to retrieve recoverable items, to execute the cmdlet successfully and without error messages.

How to Use Get-RecoverableItems in PowerShell

Now that we know what Get-RecoverableItems is for, let's now learn how to use it in just three steps.

Step 1: Connect to Exchange PowerShell Online

Launch PowerShell on your local machine or on the Exchange Server itself and then run the following command:

Connect-ExchangeOnline -UserPrincipalName youremail@meetingroom365.com

Use your Microsoft account credentials, make sure you have Mailbox Import Export role permissions, and proceed with the following step.

Step 2: Run the Get-RecoverableItems Command

Now that you're connected to Exchange, you can use the Get-RecoverableItems cmdlet to retrieve recoverable items. Here's a basic example of retrieving recoverable items from a specific mailbox:

Get-RecoverableItems -Identity james@meetingroom365.com -SubjectContains "New Meeting Rooms" -FilterItemType IPM.Note -FilterStartTime "2/1/2024 12:00:00 AM" -FilterEndTime "2/3/2024 11:59:59 PM"

In this case, the output returns all of the available recoverable deleted messages with the subject "New Meeting Rooms" the mailbox james@meetingroom365.com for the specified date/time range.

Step 3: Execute Restore-RecoverableItems if Necessary

After running the cmdlet, PowerShell will display the recoverable items based on the specified criteria. Review the results to ensure that the desired items are retrieved.

After reviewing the recoverable items retrieved by Get-RecoverableItems and identifying those that need to be restored, you can execute the Restore-RecoverableItems cmdlet to restore them to their original location within the mailbox, which might be your initial goal after all.

Summary: Using Get Recoverable Items in PowerShell

Using PowerShell's Get-RecoverableItems cmdlet is a game-changer for managing Exchange mailboxes. This command helps us to smoothly navigate through Exchange systems, recover important data, and keep everything running as it should.

Whether it's protecting against accidental deletions, staying compliant, or supporting users, this cmdlet is a must-have for maintaining data integrity and boosting productivity.