Powershell – Listing the parameters of Get-Eventlog cmdlet

powershell

I need to use the Get-Eventlog cmdlet to display just the log name and the retention period. I've used Get-Eventlog -list | format-table log, retain
but it only displays the log and the "retain" column is empty. What is the parameter for the retention period so the numbers will display along with the log name? Thanks

Best Answer

The objects returned by Get-EventLog have no such property as Retain. However, they do have a property named MinimumRetentionDays. Maybe that's what you're after. Just do a Get-EventLog -List | Select * to see what all properties are available, so that you can avoid trying to select properties that don't exist.

Get-EventLog -List | Select Log, MinimumRetentionDays