Skip to content

Conversation

@SamErde
Copy link
Contributor

@SamErde SamErde commented Feb 3, 2026

Description

Refactored powershell/public/maester/exchange/Test-MtExoMoeraMailActivity.ps1 to fix #1429, which current returns a fail status when checks actually pass.

  • Improve checks for require scopes and authentication context.
  • Proceed with obfuscated report if attempts to de-obfuscate fail.
  • More resilient cleanup of temp file in end block.
  • Improved verbose output in error handling.
  • Standardize variable naming.
  • Add timestamp to file output to avoid conflicts and clarify leftover history.
  • Fix condition where results were returned as an array instead of boolean.
  • Added words to cSpell dictionary.

Contribution Checklist

Before submitting this PR, please confirm you have completed the following:

  • 📖 Read the guidelines for contributing to this repository.
  • 🧪 Ensure the build and unit tests pass by running /powershell/tests/pester.ps1 on your local system.

…d error handling

- Improve checks for require scopes and authentication context.
- Proceed with obfuscated report if attempts to de-obfuscate fail.
- More resilient cleanup of temp file in end block.
- Improved verbose output in error handling.
- Standardize variable naming.
- Add timestamp to file output to avoid conflicts and clarify leftover history.
- Fix condition where results were returned as an array instead of boolean.
@SamErde SamErde requested a review from a team as a code owner February 3, 2026 21:04
Copilot AI review requested due to automatic review settings February 3, 2026 21:04
@SamErde SamErde requested a review from a team February 3, 2026 21:05
@SamErde SamErde added bug Something isn't working maester-test Related to a Maester test exchange Microsoft Exchanage labels Feb 3, 2026
@SamErde SamErde requested review from soulemike and removed request for a team February 3, 2026 21:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors Test-MtExoMoeraMailActivity to fix the MT.1076 result status bug, improve handling of Graph report obfuscation, and make the temp-file usage more robust, while also updating the spelling dictionary for new terminology.

Changes:

  • Rewrote Test-MtExoMoeraMailActivity to use a clear begin/process/end structure, fix the boolean return logic, and improve handling of obfuscated Graph reports (including proceeding when de-obfuscation is not possible).
  • Centralized temp CSV file handling with timestamped filenames and end-block cleanup, and improved verbose/error messaging around report retrieval and CSV import failures.
  • Added “Delicensing” and “MOERA” to .cspell.json to prevent false-positive spelling warnings.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
powershell/public/maester/exchange/Test-MtExoMoeraMailActivity.ps1 Refactors MT.1076’s implementation to correct the pass/fail boolean, handle Graph report obfuscation and CSV import more robustly, and standardize verbose and cleanup behavior.
.cspell.json Extends the custom dictionary with new domain-specific terms used by the updated Exchange tests and docs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working exchange Microsoft Exchanage maester-test Related to a Maester test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🪲 MT.1076 mixes failure status with success message (MOERA SHOULD NOT be used for sent mail)

1 participant