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-EventLog
does not have a PorpertyTime
.Use
Get-Member
to show a list of available properties.You'll see, that there is a
TimeGenerated
property, 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-WinEvent
instead, which has a-Oldest
switch.