Thursday, May 1, 2008

Exchange2007:sender filter

[PS] C:\>$domain=(Get-SenderFilterConfig).BlockedDomains
[PS] C:\>$domain= $domain +='too.com'
[PS] C:\>Set-SenderFilterConfig -BlockedDomains $domain
[PS] C:\>$domain= $domain +='new.com
'[PS] C:\>Set-SenderFilterConfig -BlockedDomains $domain
[PS] C:\>$domain= $domain +='old.com'
[PS] C:\>Set-SenderFilterConfig -BlockedDomains $domain
[PS] C:\>

[PS] C:\>$sender=(Get-SenderFilterConfig).BlockedSenders
[PS] C:\>$sender= $sender += '99@abc.com'
[PS] C:\>Set-SenderFilterConfig -BlockedSenders $sender
[PS] C:\>$sender= $sender mailto:+=
'[PS] C:\>Set-SenderFilterConfig -BlockedSenders $sender
[PS] C:\>$sender= $sender += '23@xo.com'
[PS] C:\>Set-SenderFilterConfig -BlockedSenders $sender
[PS] C:\>


===

If you have a list of blocked domain list, you can import it to excel sheet first and make sure that all domains locate on Column B.



Modify the sheet as follows:

A1:

$domain=(Get-SenderFilterConfig).BlockedDomains;

A2:

$domain= $domain +=

C2: (the beginning is two single quotes)

'';Set-SenderFilterConfig -BlockedDomains $domain;

copy the A2 down as many as you want;

copy the C2 down as many as you want;

Save the sheet as DOS txt file.

Open the dos format file You will replace all the spaces after the = sign with ='


You can copy the codes from the text file and paste it to Exchange Management Shell.