Display or Export All User Mailbox Holds

Display or Export All User Mailbox Holds

5/5 - (1 vote)

UPDATE: This tool has been updated to include implicit policies created in the Security and Compliance Center.

Last week, I was asked by a few people for information on displaying holds applied to mailboxes.

Holds come in several varieties:

  • In-Place Holds created via the Exchange Admin Center or eDiscovery case
  • Retention Policies (either as Retention or Label policies)
  • Litigation Hold set as a mailbox property
  • Legacy Exchange MRM policies

When viewed programmatically from PowerShell, you’ll notice that In-Place Holds and Retention Policies are somewhat inverse relationships like the legacy MRM policies–that is, the various policies in the Security & Compliance Center don’t have lists of objects applied to them.  Rather, for mailboxes, this data lives as part of the mailbox. In-place and Retention policy holds are part of the InPlaceHolds property, and Litigation Hold is managed through the Boolean property LitigationHoldEnabled (optionally, litigation holds can have durations, start and end dates, and owners). Linked legacy Exchange MRM policies are stored in the RetentionPolicy property of a mailbox.

For this script, you can enter a value for the -Identity parameter:

.\Get-UserHoldPolicies.ps1 -Identity PradeepG

Or, you can pipe in the output of a single Get-Mailbox:

Get-Mailbox AdeleV | .\Get-UserHoldPolicies.ps1

Or, you can pipe in all of your mailboxes:

Get-Mailbox -ResultSize Unlimited | .\Get-UserHoldPolicies.ps1

You can also pipe the output to Export-Csv so you can sort, review, categorize, or do whatever else you do with columnar data.

You can also choose whether or not to display Exchange MRM policies that contain policy tags configured with retention.  By default, those policies are shown.  To hide them, use the -ExcludeLegacyExchangePolicies switch.  In the sample tenant below with MRM  policies, you can see both with and without the legacy policies.

Get-Mailbox | .\Get-UserHoldPolicies.ps1

Get-Mailbox | .\Get-UserHoldPolicies.ps1 -ExcludeLegacyExchangePolicies

You can pick up this handy bit over at the PowerShell Gallery.

Published by Aaron Guilmette

Helping companies conquer inferior technology since 1997. I spend my time developing and implementing technology solutions so people can spend less time with technology. Specialties: Active Directory and Exchange consulting and deployment, Virtualization, Disaster Recovery, Office 365, datacenter migration/consolidation, cheese. View all posts by Aaron Guilmette

Reader Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Exit mobile version