Various useful Powershell scripts to manage Microsoft Exchange systems
To remove messages from queues which match criteria.
Get-ExchangeServer | ?{$_.IsHubTransportServer -eq $true} | Get-Queue -Filter "Status -eq 'Retry'"|get-message | Remove-Message -withNDR $false -Confirm:$false -whatif
Remove the '-whatif' from the end to use and note that no confirmation is required. Use with care! Tested on MSX 2010
To look at the SPAM logs.
[PS] C:Program FilesMicrosoftExchange ServerV14Scripts>Get-AgentLog
RunspaceId : 31331636-7c36-4df0-957f-3f279793b8de
Timestamp : 25/07/2023 15:34:51
SessionId : 08DB8BB027871FDE
IPAddress : 209.127.118.175
MessageId :
P1FromAddress : [email protected]
P2FromAddresses : {}
Recipients : {[email protected]}
Agent : Connection Filtering Agent
Event : OnRcptCommand
Action : RejectCommand
SmtpResponse : 550 5.7.1 Recipient not authorized, your IP has been found on a block list
Reason : BlockListProvider
ReasonData : bl.spamcop.net
Show top RBLs
[PS] C:Program FilesMicrosoftExchange ServerV14Scripts>.Get-AntispamTopRBLProviders.ps1
Name
----
bl.spamcop.net
psbl.surriel.com
zen.spamhaus.org
Check & review 'bad words'
[PS] C:Program FilesMicrosoftExchange ServerV14Scripts>Get-ContentFilterPhrase | Format-Table -Auto Influence,Phrase
Influence Phrase
--------- ------
BadWord Improve your website ranking
BadWord Redesign your website
BadWord 1st page of GOOGLE.
BadWord You have won
BadWord [SPAM]
BadWord WordPress Website Specialists.
BadWord The ultimate luxury Spanish property
BadWord SPAM
BadWord stock tip
BadWord christianlouboutin.com