Exporting Queue Messages

When exporting messages from a Queue, you need to use the AssembleMessage script. For example, if you want to export the message with message ID6789 from the msexchange.org queue on server MBX1, you need to run the following command:

Export-Message MBX1\msexchange.org\6789 | AssembleMessage -Path "D:\Messages\Message6789.eml"

To export all messages from a Queue into individual .eml files, use the following script (which you can convert to a one-liner command):

Get-Message -Queue "MBX1\msexchange.org" | ForEach {
     # Build message path and filename with the Internet Message ID as the file name
$Temp = "D:\Messages\" + $_.InternetMessageID + ".eml"
$Temp = $Temp.Replace("<", "_")
$Temp = $Temp.Replace(">", "_")
 
# Export the message using
Export-Message $_.Identity | AssembleMessage -Path $Temp
}

About The Author

Leave a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Scroll to Top