Log Search script

This is just a small easy script to search log content in defined location and time range for string value. If you know what to search in many log files, it can help you to narrow search.

#logsearch
#Author: Zbynek Salon
#Path to search
$path = "D:\Program Files\Microsoft\Exchange Server\V15\TransportRoles\Logs\FrontEnd\ProtocolLog\SmtpReceive"
#What to search (the best would be for example e-mail address for some SMTP log)
$str = "PRX5"
#Range (Start must be lower then end)
$start = "5/25/2014 8:00AM"
$end = "5/28/2014 9:00AM"
Get-ChildItem $path | where {($_.LastWriteTime -gt $Start) -and ($_.LastWriteTime -lt $End)} | foreach {$_
 $x = Get-Content -Path "$($path)\$_"
 if ($x -like "*$($str)*"){Write-Host "$_ contains $($str)" -ForegroundColor Green}
}