UC Unleashed » Script: Add-BadPhrasesFromFile.ps1 – Importing a File of Bad Words and Phrases into the Content Filter in Exchange Server 2010
Once upon a time, we didn’t have to worry about our sensitive eyes seeing offensive words in emails.
Times have changed, and now we have some built-in features to help prevent us from seeing terms and phrases that might be deemed offensive.
Exchange has had the capacity to define a list of words that are considered bad, and bounce messages if it comes across a message containing any.
But that can take quite a while to manually add each one to the Content Filter, especially if you’re starting out with a long list of words you’d like to filter for.
If that’s the case, PowerShell to the rescue! We can use Get-Content to open a text file, and then a ForEach loop to cycle through each line, adding each to the content filter phrase list via Add-ContentFilterPhrase.
Add-ContentFilterPhrase can add words and phrases to either the GoodWord list, which will allow words through, or the BadWords list, which will get blocked.