Powershell to export all Outlook emails as individual MSG files with attachments

The script presents a dialog box to choose the outlook folder to export as individual messages including attachments and replicates folder structure.

The filename of the email is saved as:

Outlook_foldername-dateYYMMDD-Time-SenderName-EmailSubject.msg

Attachments are saved with the same filename appending the attachment filename eg:

Outlook_foldername-dateYYMMDD-Time-SenderName-EmailSubject-attachment_name.extension

How to use:

Edit the script line “# Configuration” to change where the MSG files will be saved into.

# Configuration
$ExportPath = “C:\OutlookExport”

Run PowerShell as administrator.

Ensure your PowerShell execution policy allows scripts type and agree with the prompt:

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned

run the script and choose the outlook folder to extract, it will be recursive.

DOWNLOAD outlook2msg

 

 

Posted on January 28, 2026, 11:29 pm By
Categories: tech tips