If you use KnowBe4 and your clients use Office 365 then you know how long it can take to setup the filtering rules and get all of the client’s users added to KB4. I have created a Powershell script that creates the spam filtering bypass rules and returns a list of users in CSV form ready to be uploaded to KnowBe4.


First you have to run the batch file that downloads the Exchange Online Powershell module and sets your network type to private because I had problems connecting with the Exchange Online module when my network type was domain.

Once you run the ps1 script it will ask what account you want to setup. This is the client’s O365 admin account. The Exchange Online module opens and ask you to login. It enables organization customization then starts adding the spam filtering bypass rules. At the end it exports a list of emails, first name, and last name in a CSV so that it can be uploaded to KnowBe4.


There was probably a more elegant solution to this but it works. If you have a better solution please fill out the contact form on the home page, I would love to talk to you.

Categories: Automation

Leave a Reply

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

%d bloggers like this: