PowerShell script for avoiding SPAM, Clutter, Junk in 365

21st May 2025 | 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.

CyberHoot does have some other resources available for your use. Below are links to all of our resources, feel free to check them out whenever you like: 

Note: If you’d like to subscribe to our newsletter, visit the Newsletter link and enter your email address on the right-hand side of the page, and click ‘Send Me Newsletters’.

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.

Make Phishing Training Count with HootPhish

Make Phishing Training Count with HootPhish

Stop tricking employees. Start training them. Take Control of Your Security Awareness Training with a Platform...

Read more
Apple Alert: Critical AirPlay Vulnerabilities Expose Millions to Cyber Threats

Apple Alert: Critical AirPlay Vulnerabilities Expose Millions to Cyber Threats

A recent discovery by cybersecurity firm Oligo Security has unveiled a series of critical vulnerabilities in...

Read more
CyberHoot Newsletter – May 2025

CyberHoot Newsletter – May 2025

Welcome to CyberHoot's May Newsletter! This month, we're spotlighting key developments in the cyber threat...

Read more