Backup/Restore/Manage your Exchange whitelist using exchange management shell

I will show you today how to manage, backup and restore you sender safe list on Exchange 2007 and 2010 using exchange management shell cmdlets.

To add a entry

$SafeSenders = (Get-ContentFilterConfig).bypassedSenders
$SafeSenders.Add("[email protected]")
Set-ContentFilterConfig -BypassedSenders $SafeSenders

To remove an entry

$SafeSenders = (Get-ContentFilterConfig).bypassedSenders
$SafeSenders.Remove("[email protected]")
Set-ContentFilterConfig -BypassedSenders $SafeSenders

To backup the list

Of course you can use the ExportEdgeConfig.ps1 script to do it, however you might want to backup just the sender safe list in that case use the following script

(Get-ContentFilterConfig).bypassedSenders | export-csv c:\SafeList.csv

To restore the list

Set-ContentFilterConfig -BypassedSenders:$null
$SafeList = (Get-ContentFilterConfig).bypassedSenders
import-csv C:\SafeList.csv | foreach{ $email = $_.local += "@"; $email += $_.domain; $SafeList.add($email)}
Set-ContentFilterConfig -BypassedSenders:$SafeList

I have been working in IT consultancy and solution integration since 1998 and I consider myself lucky to be, one in a few, making a living out of my passion. I am also member of the famous Experts Exchange (profile here) online community where I try my best to share what I have learned along the road.

Posted in Messaging & Collaboration Tagged with: , , , , ,
One comment on “Backup/Restore/Manage your Exchange whitelist using exchange management shell
  1. David Mulfinger says:

    Is there an easy way to import a csv filee that is [email protected],[email protected],[email protected]…etc or Do I have to make it look like the exported csv.

Leave a Reply

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

*