Hello,
Below are a few different ways you can retrieve the dates of in-place (eDiscovery) holds via PowerShell. In Exchange (both on‐premises and online) when you place a mailbox on hold, the mailbox object gets properties such as LitigationHoldEnabled and LitigationHoldDate populated. The LitigationHoldDate property records when the hold was applied.
Below are sample approaches:
──────────────────────────────
- For All Mailboxes (Exchange Online or On‑Premises)
To see all mailboxes that have a litigation hold along with the date it was enabled, you can run:
Get-Mailbox -ResultSize Unlimited |
Where-Object { $_.LitigationHoldEnabled -eq $true } |
Select-Object DisplayName, UserPrincipalName, LitigationHoldDate |
Format-Table –AutoSize
This command does the following:
• Retrieves all mailboxes.
• Filters for mailboxes with LitigationHoldEnabled set to true.
• Selects the DisplayName (or you might choose another property such as UserPrincipalName) and LitigationHoldDate.
• Formats the output as a table.
──────────────────────────────
- For a Specific List of Mailboxes
If you have a list of mailboxes (for example, stored in a CSV file that includes an “EmailAddress” or “UserPrincipalName” column), you can import the list and then query each mailbox. For example, if your CSV file is located at C:\MailboxList.csv and contains a header such as “EmailAddress”, use:
$mailboxes = Import-Csv "C:\MailboxList.csv"
foreach ($mb in $mailboxes) {
Get-Mailbox -Identity $mb.EmailAddress |
Select-Object DisplayName, UserPrincipalName, LitigationHoldDate |
Format-Table –AutoSize
}
This script:
• Imports the CSV into the variable $mailboxes.
• Loops through each mailbox and queries its properties.
• Displays DisplayName, UserPrincipalName, and LitigationHoldDate.
──────────────────────────────
- Directly Query a Specific Mailbox
If you only need to examine one mailbox, simply specify the identity:
Get-Mailbox -Identity "user@example.com" | Select-Object DisplayName, LitigationHoldDate
This outputs the display name and the date when the in-place hold was applied (if any).
──────────────────────────────
Notes
• Ensure you have connected to your Exchange environment before running these commands. For Exchange Online, you might need to use the EXO V2 module (Connect-ExchangeOnline) or for on-premises use the Exchange Management Shell.
• The LitigationHoldDate property will be null if the mailbox is not on hold.
• The property names may differ for older versions of Exchange or if you’ve customized the setup. Always verify with Get-Mailbox | Get-Member if needed.
If the Answer is helpful, please click "Accept Answer" and upvote it.