Share via

Export-QuarantineMessage Fail: Undocumented Parameter Dependency between ReasonForExport and CompressOutput

Niv BenSalmon 120 Reputation points
2026-01-06T13:15:34.15+00:00

Hello,

I am encountering an undocumented behavior with the Export-QuarantineMessage cmdlet in the Exchange Online PowerShell module (V3).

The Issue: According to the official Microsoft documentation, both -ReasonForExport and -CompressOutput are listed as optional parameters. However, I have discovered a hard dependency where the cmdlet fails if a reason is provided without the compression switch set to true.

When running the command with only the ReasonForExport ( parameter:

The command fails with the following error:

"Cannot process command because of missing mandatory parameters: CompressOutput."

Expected Result: The command should execute successfully, as neither parameter is marked as mandatory in the cmdlet definition or documentation.

If I add -CompressOutput $false, the commands give the same error.
If I add -CompressOutput $true, the command works as expected.

Questions :

Is this a known design requirement where metadata (Reason) can only be exported within a compressed archive?

  • Are there other undocumented parameter dependencies for this cmdlet that we should be aware of for automation purposes?

Thank you for your assistance.

Exchange Online
Exchange Online

A cloud-based service included in Microsoft 365, delivering scalable messaging and collaboration features with simplified management and automatic updates.

0 comments No comments

Answer accepted by question author

Vergil-V 14,780 Reputation points Microsoft External Staff Moderator
2026-01-06T14:57:47.4666667+00:00

Hi @Niv BenSalmon 

Thanks for reaching out to the Microsoft Q&A forum.

I tried to replicate the situation in my environment, and here’s what I’ve observed so far: 

When running Export-QuarantineMessage with only the –ReasonForExport parameter, I received the same response you described. undefined

After adding –CompressOutput, the command executed successfully.undefined

However, when I specified a value for -CompressOutput, I encountered an error indicating that this parameter does not accept explicit values.  

undefined

This aligns with the official documentation: Export-QuarantineMessage (ExchangePowerShell) | Microsoft Learn 

undefined

 Based on this, the behavior seems slightly different from what I understood from your description. Could you confirm if the same situation occurs in your environment? 

During my research, I couldn’t find any official documentation stating that –CompressOutput is required when using –ReasonForExport. Additionally, through testing, I discovered that –CompressOutput is also required when using –PasswordV2

That said, aside from my findings regarding –PasswordV2, if your environment does not behave the same way as mine, I recommend raising a support ticket with the Microsoft Support team through the Microsoft Admin Center for deeper assistance. 

I hope this provides additional insight. If you have any updates or further questions, please feel free to reach out.


Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

Was this answer helpful?


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.