Wednesday 7 January 2015

[FastToUse] - Find Exchange 2010 AntiSpam filtered e-mails.

What?
When you need to check if an email is filtered by Exchange 2010 AntiSpam filters, it use to be a tedious task. This will not be a problem if you use a simple script to find the filtered e-mail by domain o full-e-mail address.

Fast Instructions:
  • Copy & Paste the following PowerShell code into a FindSPAMemails.ps1 file.
  • Save the file in a accessible site in order to use it when necessary.
PowerShell:

add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010; . 'C:\Program Files\Microsoft\Exchange Server\V14\bin\Exchange.ps1'
cls
while (1 -eq 1){
                $domini = Read-Host 'Enter the domain name or mail address(i.e: domain.com or mail@domain.com)'
                Write-Host "You entered: " $domini " , starting search..."
                Get-AgentLog | select P1FromAddress,P2FromAddresses,Agent,Action,Reason,ReasonData,Diagnostics,Timestamp | where {$_.Action -ne "AcceptMessage"} | where {$_.P1FromAddress -like "*$domini*"}
                $opcio = Read-Host 'Continue searching? (Y/N), default option -> N'
                while ($ok -ne "ok"){
                               if(($opcio -eq "N") -or ($opcio -eq "n") -or ($opcio -eq "")) {exit}
                               elseif(($opcio -eq "Y") -or ($opcio -eq "y")) {$ok="ok"}
                               else{
                                               $opcio = Read-Host 'Incorrect option, continue searching? (Y/N), default option -> N'
                               }
                }
                $ok=""
}

More Information:

No comments:

Post a Comment