I'm trying to find the oldest retained Event in the Security Event Log through powershell.
Using the following command: (Get-EventLog Security | Sort-Object -Property Time -Descending)
This returns a list which is not sorted in the least. What am I doing wrong here?
                        
This is not a problem with
Get-EventLog, but caused by the fact that the output ofGet-EventLogdoes not have a PorpertyTime.Use
Get-Memberto show a list of available properties.You'll see, that there is a
TimeGeneratedproperty, which you can use.Furthermore I'd like to add, that that's the default order anyway. But if you want to switch the order, I recommend using
Get-WinEventinstead, which has a-Oldestswitch.