show sql errorlog messages since a specified date

This almost speaks for itself…but it might be worth noting that:

  • I’m only interogating the latest file here
  • it’s a teeny bit cumbersome – I would probably function-alize it
  • the big advantage here compared to the GUI is you can cut-and-paste it _really easily_
$logs = dir sqlserver:sql_the_server_name
$logs.readerrorlog(0) |
  where logdate -gt ([datetime]::ParseExact('25/02/2015 07:27:36',"dd/MM/yyyy HH:mm:ss",$null))  |
  select processinfo, text |
  ft -a -wrap
Advertisements