共用方式為


Display or Export All User Mailbox Holds

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 TechNet Gallery.

Comments

  • Anonymous
    November 02, 2017
    thanks