mikedopp icon

kerio

mikedopp | PRO | 07/19/16 12:47:51 AM UTC | 0 ⭐ | 361 👁️ | Never ⏰ | []
PowerShell |

740 B

|

None

|

0 👍

/

0 👎

$Queuepathfull = "E:\Kerio\MailServer\store\queue"
$queuepaths = Get-ChildItem $Queuepathfull
$String = "[email protected]"
foreach ($Queuepath in $queuepaths) {
    $allemf = $null
    $email = $null
    write-host "Starting on $($queuepath.fullname)"
    $allemf = get-childitem $Queuepath.fullname -Recurse -Filter '*.emf'
    foreach ($emf in $allemf) {
        $email = Get-Content -Encoding Ascii -path $emf.fullname
        if ($email -match $string) {
            $Deletecount++
            write-host "Deleteing e-mail $($deletecount) ($($emf.name))"
            Remove-Item $emf.FullName
            Remove-Item $emf.FullName.replace(".emf",".eml")
            Remove-Item $emf.FullName.replace(".emf",".env")
            }
    }
}

Comments