I am trying to get all the windows events of today
Get-WinEvent -ComputerName myComputer -FilterHashtable @{
StartTime={[datetime]::Today.ToString('DD/MM/YY')}
EndTime={[datetime]::Today.ToString('DD/MM/YY')}
}
I have a wrong dateTime format error. What is the correct format ?
CodePudding user response:
You can directly pass the date object. See the docs for more information
Get-WinEvent -ComputerName myComputer -FilterHashtable @{StartTime=[datetime]::Today}