mikedopp

kerio

Jul 18th, 2016
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $Queuepathfull = "E:\Kerio\MailServer\store\queue"
  2. $queuepaths = Get-ChildItem $Queuepathfull
  3. $String = "eamil@problem.com"
  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. }
Add Comment
Please, Sign In to add comment