Advertisement
guyrleech

Show Event Log Information/Statistics

Mar 21st, 2023
952
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ## Get all event logs available and show stats for them such as newest and oldest events, record count and maximum file size
  2.  
  3. Get-WinEvent -ListLog *|ForEach-Object { $oldest = Get-WinEvent -LogName $_.LogName -Oldest -MaxEvents 1 -ErrorAction SilentlyContinue ; $_ | Select LogName,RecordCount,@{n='Oldest';e={$oldest|Select -expand TimeCreated}},LastWriteTime,@{n='Max Size(MB)';e={($_.MaximumSizeInBytes)/1MB -as [int]}},IsLogFull,IsEnabled,LogMode} |ogv
  4.  
  5. ## add LogFilePath to Select statement if on Citrix and you want to see which logs are written to a persistent drive
  6.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement