Get-AllEvents

 Function Get-AllEvents{


param([string]$computername = $env:COMPUTERNAME, [datetime]$startdateandtime, [datetime]$enddateandtime )

$logs= (Get-WinEvent -ListLog * | Where-Object {$_.recordcount}).logname

$Filtertable = @{
    StartTime = $startdateandtime
    EndTime = $enddateandtime
    LogName = $logs
}

Get-WinEvent -ComputerName $computername  -FilterHashtable $Filtertable -ErrorAction SilentlyContinue


}

Get-AllEvents -startdateandtime '07/06/2020 01:00' -enddateandtime '07/08/2020 11:00'

Comments

Popular posts from this blog

powershell script to export applications and its requirement in weird way

get-allrecent udpated logs

TASK sequence duration report