HowTo: Powershell script for avoiding SPAM, Clutter, Junk in 365

21st June 2025 | HowTo HowTo: Powershell script for avoiding SPAM, Clutter, Junk in 365

Microsoft M365 PowerShell Scripts: 

  • Bypass SPAM, Clutter and Junk in M365.

Microsoft PowerShell scripts automate a more realistic and successful phish testing environment when set up correctly.  This is one of two scripts that help deliver phishing tests into end-users inboxes and automates downloading images without warning or end-user interaction by adding CyberHoot sending domains to each user’s safe senders list.

You can find more information on how to implement PowerShell scripts through Exchange here and through Azure Active directory here.

How to By-Pass Junk, Spam, and Clutter:

Implement these four mail flow rules to bypass Junk, Spam and Clutter by IP and email Header. This script also sets up the X-Header for mail filters in series.

PowerShell Script to Bypass Clutter Spam and Junk Folders in M365

Save this text file as a .ps1 file and then run as a PowerShell script with appropriate permissions.

Latest Blogs

Stay sharp with the latest security insights

Discover and share the latest cybersecurity trends, tips and best practices – alongside new threats to watch out for.

Attackers Don’t Need a Key. They Already Have Yours.

Attackers Don’t Need a Key. They Already Have Yours.

Most breaches don't start with a hacker in a hoodie cracking code at 3am. They start with your username and a...

Read more
Claude Mythos Opened Pandora’s Box. Project Glasswing Is Racing to Close It.

Claude Mythos Opened Pandora’s Box. Project Glasswing Is Racing to Close It.

Article Updates: As of May 6th 2026, every major U.S. AI lab, including Google DeepMind, Microsoft, xAI,...

Read more
When the “CEO” Calls and Asks You to Move Money Fast

When the “CEO” Calls and Asks You to Move Money Fast

A guide to spotting senior executive impersonation scams before the fake CEO gets a real wire transfer. It...

Read more