Have you ever worked in an organization where you have had to enable LitigationHold on a user or multiple users mailboxes because something has happened or it is a case where every mailbox has it enabled. I have seen both and it is something quite simple to do. There are a few items that you need to take into consideration such as:

  • The Owner – Maybe this is the person who authorized it or the end users Manager.
  • Duration – How long do you want to set this for. If you do not specify a timeframe, it will be set to “unlimited”

When you apply LitigationHold on a mailbox, you can just set the Boolean variable to $true and it will be set with the defaults. If you want to specify the duration and owner then the command will be a bit longer. Below is the output of the script I put together to get this information:

Quickly get a list of all mailboxes with litigationhold enabled in exchange 2019

If you run the Get-Mailbox command and you look at the LitigationHold options, the bottom four (4) in the list will show, I added the Display Name and Primary SMTP Address to the script to make it easier to identify.

SCRIPT

The script is easy to understand. I add the PowerShell Snapin for Exchange so you are able to run it from another machine or using PowerShell or PowerShell ISE, below is the script:

# Import the Exchange module
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn

$mailboxes = Get-Mailbox -Filter {LitigationHoldEnabled -eq $true} -ResultSize Unlimited

# Display information about mailboxes with litigation hold
foreach ($mailbox in $mailboxes) {
    Write-Host "--------------------------------------"
    Write-Host "DisplayName: $($mailbox.DisplayName)"
    Write-Host "PrimarySMTPAddress: $($mailbox.PrimarySmtpAddress)"
    Write-Host "LitigationHoldEnabled: $($mailbox.LitigationHoldEnabled)"
    Write-Host "LitigationHoldDate: $($mailbox.LitigationHoldDate)"
    Write-Host "LitigationHoldDuration: $($mailbox.LitigationHoldDuration)"
    Write-Host "LitigationHoldOwner: $($mailbox.LitigationHoldOwner)"
    Write-Host "--------------------------------------"
}

If you want to rather export the information to CSV, you can do so at the end of the script by adding another line.

Hope it helps.

Discover more from Everything-PowerShell

Subscribe now to keep reading and get access to the full archive.

Continue reading