Wednesday, April 8, 2015

Short Spam and Content Filter Scripts for Exchange 2013

ShowCurrentConfig

 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn  
 $cfc = Get-ContentFilterConfig  
 $sfc = Get-SenderFilterConfig  
 Write-Host 'Blacklisted Senders:'  
 $sfc | Select-Object -ExpandProperty BlockedSenders  
 Write-Host ' '  
 Write-Host ' '  
 Write-Host ' '  
 Write-Host 'Whitelisted Senders:'  
 $cfc | Select-Object -ExpandProperty BypassedSenders  
 Write-Host ' '  
 Write-Host ' '  
 Write-Host ' '  
 Write-Host 'Blacklisted Domains:'  
 $sfc | Select-Object -ExpandProperty BlockedDomains  
 Write-Host ' '  
 Write-Host ' '  
 Write-Host ' '  
 Write-Host 'Blacklisted SubDomains:'  
 $sfc | Select-Object -ExpandProperty BlockedDomainsAndSubdomains  
 Write-Host ' '  
 Write-Host ' '  
 Write-Host ' '  
 Write-Host 'Whitelisted Domains:'  
 $cfc | Select-Object -ExpandProperty BypassedSenderDomains  
 Write-Host ' '  
 Write-Host ' '  
 Write-Host ' '  

WhiteListSpamSender

 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn  
 $sender = Read-Host 'Enter the name of the sender you would like to WHITELIST '  
 Set-ContentFilterConfig -BypassedSenders @{Add=$sender}  

WhiteListSpamDomain

 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn  
 $domain = Read-Host 'Enter the name of the domain you would like to WHITELIST '  
 Set-ContentFilterConfig -BypassedSenderDomains @{Add=$domain}  

unWhiteListSpamSender

 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn  
 $sender = Read-Host 'Enter the name of the sender you would like to REMOVE from WHITELIST '  
 Set-ContentFilterConfig -BypassedSenders @{Remove=$sender}  

UnWhiteListSpamDomain

 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn  
 $domain = Read-Host 'Enter the name of the domain you would like to REMOVE from WHITELIST '  
 Set-ContentFilterConfig -BypassedSenderDomains @{Remove=$domain}  

BlackListSender

 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn  
 $sender = Read-Host 'Enter the name of the sender you would like to BLACKLIST '  
 Set-SenderFilterConfig -BlockedSenders @{Add=$sender}  

BlackListDomain

 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn  
 $domain = Read-Host 'Enter the name of the domain you would like to BLACKLIST '  
 Set-SenderFilterConfig -BlockedDomains @{Add=$domain}   

UnBlackListSender

 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn  
 $sender = Read-Host 'Enter the name of the sender you would like to REMOVE from BLACKLIST '  
 Set-SenderFilterConfig -BlockedSenders @{Remove=$sender}  

UnBlackListDomain

 Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn  
 $domain = Read-Host 'Enter the name of the domain you would like to REMOVE from BLACKLIST '  
 Set-SenderFilterConfig -BlockedDomains @{Remove=$domain}  

No comments:

Post a Comment