# E365-Quarantine-ExportRecord.ps1

  • Purpose
  • Dependencies
  • Function
  • Usage
  • Inputs
  • Variables
  • Command Line Flags
  • Outputs
  • Notes

# Purpose

Exports Microsoft 365 Exchange quarantine message records and Tenant Allow/Block List (TABL) data to CSV files for analysis. Supports cross-platform operation (Windows, macOS, Linux), robust error handling, and modern authentication (FIDO2/WebAuthn).

This is to assist email administrators in using an accompying XLS file to quickly reconcile domains in quarantine, which are not already in the Tenant Allow/Block List (TABL), and drive faster action for adding domains for blocking via TABL.

Previously downloaded CSV files are archived at the start of the script, to ensure these records can be kept if needed.

# Dependencies

# Function

  1. Detects operating system and sets cross-platform file paths for output and archiving.
  2. Ensures required directories exist and archives previous CSV files with date-stamped names.
  3. Validates PowerShell 7 environment and required modules, installing if needed.
  4. Connects to Exchange Online using modern authentication.
  5. Downloads up to 10,000 quarantine message records (paginated) and exports to quarantine.csv.
  6. Downloads Tenant Allow/Block List (Sender type) and exports to tabl.csv.
  7. Provides robust error handling, progress indication, and clear user feedback.

# Usage

./E365-Quarantine-ExportRecord.ps1

The script is fully interactive and does not require command-line parameters for standard use. Output files are saved to platform-specific locations.

# Inputs

None for standard use. (All paths and options are handled interactively and by platform detection.)

# Variables

  • $directoryPath: Output directory for CSV files
  • $targetFolder: Archive directory for old CSVs
  • $filePathQuarantine, $filePathTABL: Output file paths
  • $moduleNames: Required modules

# Command Line Flags

None for standard use.

# Outputs

  • quarantine.csv: Quarantine message records
  • tabl.csv: Tenant Allow/Block List data
  • Archived previous CSVs with date-stamped names
  • Console and error output for user feedback

# Notes

  • Requires PowerShell 7 and Exchange Online Management module
  • Script is cross-platform and handles all file paths automatically
  • See script header for links to official documentation and further details