View difference between Paste ID: uEdpydvE and xrR1mub6
SHOW: | | - or go back to the newest paste.
1
$Queuepathfull = "E:\Kerio\MailServer\store\queue"
2
$queuepaths = Get-ChildItem $Queuepathfull
3
$String = "[email protected]"
4
foreach ($Queuepath in $queuepaths) {
5
    $allemf = $null
6
    $email = $null
7
    write-host "Starting on $($queuepath.fullname)"
8
    $allemf = get-childitem $Queuepath.fullname -Recurse -Filter '*.emf'
9
    foreach ($emf in $allemf) {
10
        $email = Get-Content -Encoding Ascii -path $emf.fullname
11
        if ($email -match $string) {
12
            $Deletecount++
13
            write-host "Deleteing e-mail $($deletecount) ($($emf.name))"
14
            Remove-Item $emf.FullName
15
            Remove-Item $emf.FullName.replace(".emf",".eml")
16
            Remove-Item $emf.FullName.replace(".emf",".env")
17
            }
18
    }
19
}