Hi,
I need to do a search in system or security logs and find a special ID log (for example event id : 1022) and clears all of those logs
i tested
Get-EventLog "System" | Where-Object {$_.EventID -eq 16397}
and
Get-WinEvent "System" | Where-Object {$_.EventID -eq 16397}
but did not work, (Get Works but clear makes the below error) seems logs are not sent to these commands as separate identities
PS C:\> Get-EventLog "System" | Where-Object {$_.EventID -eq 16397} | Clear-EventLog
Clear-EventLog : Object reference not set to an instance of an object.
At line:1 char:78
+ Get-EventLog "System" | Where-Object {$_.EventID -eq 16397} | Clear-EventLog <<<<
+ CategoryInfo : NotSpecified: (:) [Clear-EventLog], NullReferenceException
+ FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.ClearEventLogCommand
Payne is back