aleinss

Untitled

Nov 7th, 2025
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. # Assumes the compliance session is already open
  2. # (Connect-IPPSSession or Connect-ExchangeOnline -ExchangeEnvironmentName O365SecCompliance)
  3. #Connect-IPPSSession # compliance endpoint
  4.  
  5. Connect-IPPSSession -EnableSearchOnlySession
  6.  
  7. $SearchName = '11072025_01' # whatever you called it
  8.  
  9. # --------------------------------------------------------------------------
  10. # 1. Quick status / counts
  11. # --------------------------------------------------------------------------
  12. Get-ComplianceSearch -Identity $SearchName |
  13. Format-List Name,Status,Items,Size
  14.  
  15. # --------------------------------------------------------------------------
  16. # 2. Interactive preview (returns up to first 200 hits)
  17. # • Creates a temporary search action called <SearchName>_Preview
  18. # • The .Results property contains Subject, Sender, Path, ReceivedTime …
  19. # --------------------------------------------------------------------------
  20. $previewAction = New-ComplianceSearchAction `
  21. -SearchName $SearchName `
  22. -Preview `
  23. -ActionName "${SearchName}_Preview"
  24.  
  25. # Poll until the preview is ready
  26. do {
  27. Start-Sleep -Seconds 10
  28. $state = (Get-ComplianceSearchAction -Identity $previewAction.Name).Status
  29. } until ($state -match 'Completed|Failed')
  30.  
  31. # Display the preview items (if any)
  32. Get-ComplianceSearchAction -Identity $previewAction.Name |
  33. Select-Object -ExpandProperty Results |
  34. Format-Table ReceivedTime, Sender, Subject, Path, Size -AutoSize
  35.  
  36. Get-ComplianceSearch -Identity $SearchName | Select-Object -ExpandProperty SuccessResults
  37.  
  38. # --------------------------------------------------------------------------
  39. # 3. Full export (PST or native files)
  40. # • Creates <SearchName>_Export
  41. # • Download with the eDiscovery Export Tool or Azure Storage Explorer
  42. # --------------------------------------------------------------------------
  43. #$exportAction = New-ComplianceSearchAction `
  44. # -SearchName $SearchName `
  45. # -Export `
  46. # -Name "${SearchName}_Export"
  47. #
  48. #Write-Host "Export job submitted. Check the Purview portal > Content search > Exports for the download link."
  49.  
  50.  
Advertisement
Add Comment
Please, Sign In to add comment