There are many posts that show you how to create a whitelist using PowerShell:
Set-ContentFilterConfig -BypassedSenders name@domain.tld
or
Set-ContentFilterConfig -BypassedSenderDomains domain.tld
The only problem is that when you check your list using the Get-ContentFilterConfig command, the bypassed senders and/or the bypasses sender domains only show the last entry you made! This is because each time you use the Set-ContentFilterConfig command, you overwrite the content filter configuration with a new configuration file! In other words, the entries are not cumulative; each new entry replaces the last one.
Here’s how to add e-mail addresses to a whitelist using PowerShell:
For individual e-mail addresses:
$list = (Get-ContentFilterConfig).BypassedSenders
$list.add(“address@domain.com”)
Set-ContentFilterConfig -BypassedSenders $list
For domains:
$list = (Get-ContentFilterConfig).BypassedSenderDomains
$list.add(“domain.com”)
Set-ContentFilterConfig -BypassedSenderDomains $list
To remove an entry, use the following command(s):
Set-ContentFilterConfig -BypassedSenderDomains @{Remove=”domain.com”}
Set-ContentFilterConfig -BypassedSenders @{Remove=”mail.domain.com”}
Cumulative Whitelisting in Exchange 2007, 2010, 2013
In the example below, I will whitelist several e-mail domains.
Running the Get-ContentFilterConfig command to enumerate the ByPassedSenderDomains list reveals that there is one domain whitelisted: falconitservices.com.
We execute Set-ContentFilterConfig –ByPassedSenderDomains falconitservices.net.
As you can see, the falconitservices.net has not been added to the Bypassed Sender Domains, instead it replaced falconitservices.com.
Now let’s try the cumulative method. Execute $list=(GetContentFilterConfig).ByPassedSenderDomains
Let’s begin by adding some whitelist entries:
When finished, execute Set-ContentFilterConfig –BypassedSenderDomains $list
When you run Get-ContentFilterConfig, you will see your white list.
Let’s add some more by repeating the same process.
When you run Get-ContentFilterConfig, you will see that technet.microsoft.com has been added to the white list. The prior entries are still there.
Using this method, you can add whitelist entries on an as-needed basis and grow your white list.