Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Assumes the compliance session is already open
- # (Connect-IPPSSession or Connect-ExchangeOnline -ExchangeEnvironmentName O365SecCompliance)
- #Connect-IPPSSession # compliance endpoint
- Connect-IPPSSession -EnableSearchOnlySession
- $SearchName = '11072025_01' # whatever you called it
- # --------------------------------------------------------------------------
- # 1. Quick status / counts
- # --------------------------------------------------------------------------
- Get-ComplianceSearch -Identity $SearchName |
- Format-List Name,Status,Items,Size
- # --------------------------------------------------------------------------
- # 2. Interactive preview (returns up to first 200 hits)
- # • Creates a temporary search action called <SearchName>_Preview
- # • The .Results property contains Subject, Sender, Path, ReceivedTime …
- # --------------------------------------------------------------------------
- $previewAction = New-ComplianceSearchAction `
- -SearchName $SearchName `
- -Preview `
- -ActionName "${SearchName}_Preview"
- # Poll until the preview is ready
- do {
- Start-Sleep -Seconds 10
- $state = (Get-ComplianceSearchAction -Identity $previewAction.Name).Status
- } until ($state -match 'Completed|Failed')
- # Display the preview items (if any)
- Get-ComplianceSearchAction -Identity $previewAction.Name |
- Select-Object -ExpandProperty Results |
- Format-Table ReceivedTime, Sender, Subject, Path, Size -AutoSize
- Get-ComplianceSearch -Identity $SearchName | Select-Object -ExpandProperty SuccessResults
- # --------------------------------------------------------------------------
- # 3. Full export (PST or native files)
- # • Creates <SearchName>_Export
- # • Download with the eDiscovery Export Tool or Azure Storage Explorer
- # --------------------------------------------------------------------------
- #$exportAction = New-ComplianceSearchAction `
- # -SearchName $SearchName `
- # -Export `
- # -Name "${SearchName}_Export"
- #
- #Write-Host "Export job submitted. Check the Purview portal > Content search > Exports for the download link."
Advertisement
Add Comment
Please, Sign In to add comment