Wednesday, July 4, 2018

Exchange Mailbox Litigation Hold Size Report

Most companies always have some sort of litigation going on, which requires putting users' mailboxes on hold to keep historical data. Sometimes I forget who's on litigation hold, and they stay in that state long after they should be - taking up storage space on Exchange.

I created a little script that will spit out an HTML report of mailboxes with litigation hold enabled and their total size.
This is also useful for when your higher-ups need that info for auditing and such, since it's easy to read in HTML format.

Grab the script from my Google Drive here.


Copy the following block and save as Litigation-Report.ps1

$style = "<style>BODY{font-family: Arial; font-size: 10pt;}"
$style = $style + "TABLE{border: 1px solid black; border-collapse: collapse;}"
$style = $style + "TH{border: 1px solid black; background: #dddddd; padding: 5px; }"
$style = $style + "TD{border: 1px solid black; padding: 5px; }"
$style = $style + "</style>"

Get-Mailbox -ResultSize Unlimited -Filter {LitigationHoldEnabled -eq $True} | Get-MailboxStatistics | Sort totalitemsize -desc | select displayname, totalitemsize | ConvertTo-HTML -head $style | out-file Litigation_Size.htm

Once you have the script downloaded or copied, fire up the EMS (Exchange Management Shell) and cd to the location where you saved it.

Next, run Litigation-Report.ps1

The script will save the "Litigation_Size.htm" in the same location as the .ps1 file.

Now you have a nice, pretty report...give it your legal department and tell them they're using too much space :)

No comments:

Post a Comment