Export Litigation Hold Data in PowerShell

I am trying to create an export of all litigation holds with their sources and other useful information. I have tried the following script and it works great for an individual hold. But when I try it without the Identity to get all holds it leaves several columns empty. Any ideas?

Works as expected:

Get-MailboxSearch"Legal Hold"|Select-ObjectName,@{n="SourceMailboxes";e={($_|select-ExpandPropertySourceMailboxes) -join','}},@{n="Sources";e={($_|select-ExpandPropertySources) -join','}},Description,PreviewResultsLink,ResultNumberEstimate,ResultSizeEstimate,ResultsLink,ResultNumber,ResultSize|Export-CSVd:\Exports\LegalHoldSearch.csv-notypeinformation

This does not give SourceMailbox and Sources data:

Get-MailboxSearch|Select-ObjectName,@{n="SourceMailboxes";e={($_|select-ExpandPropertySourceMailboxes) -join','}},@{n="Sources";e={($_|select-ExpandPropertySources) -join','}},Description,PreviewResultsLink,ResultNumberEstimate,ResultSizeEstimate,ResultsLink,ResultNumber,ResultSize|Export-CSVd:\Exports\LegalHoldSearch.csv-notypeinformation



August 26th, 2015 10:57am

Yeah, seems they consider the SourceMailboxes an 'expensive' attribute, thus when you use the 'bulk' variant, the info is not presented. Use this instead:

Get-MailboxSearch | Select-Object Name,@{n="SourceMailboxes";e={ (Get-MailboxSearch $_.Identity).SourceMailboxes}}

  • Marked as answer by jcollotzi 10 hours 58 minutes ago
Free Windows Admin Tool Kit Click here and download it now
August 26th, 2015 3:08pm

That worked, thanks.
August 26th, 2015 4:29pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics