Forum Discussion
Ravi Harariya
Mar 05, 2025Copper Contributor
Release mails from Quarantine via PowerShell
Hello folks
I'm Trying to create to create the Powershell scrpit to relese the mails .
# Parameters
$malwareName = "- / XM/Laroux.CF" # Name of the detected malware
$excludedIp = "0.0.0.0" # IP address to exclude
# Step 1: Get quarantined messages for the specific email address
$quarantinedMessages = Get-QuarantineMessage
# Step 2: Filter by the recipient email address, malware name, and exclude specific IP
$filteredMessages = $quarantinedMessages | Where-Object {
$_.RecipientAddress -eq $emailAddress -and
$_.MalwareDetected -eq $malwareName -and
$_.SenderIP -ne $excludedIp
}
# Step 3: Release filtered quarantined messages
foreach ($msg in $filteredMessages) {
# Release the quarantined message
Release-QuarantineMessage -Identity $msg.Identity
Write-Host "Released message with Identity: $($msg.Identity)"
}
Thanks
- Salamat_ShahIron Contributor
This is a good initiative; however, I believe it would be more effective to share it in the designated community discussion area for broader visibility and engagement.