Managing SQL Server Error Logs

Mike Fal shows us how to mange SQL Server error logs using Powershell:

Reading SQL Server error logs is pretty simple, but requires us to make use of the SMO objects and the .ReadErrorLog() method to get the data from the log. Let’s start by simply reading the SQL Server error log and see what the output looks like (I’ll be using the SQL Server provider for this)

The big benefit, as Mike points out, is that the log rows are considered objects, meaning you don’t need to try to parse out things like the log date.

Related Posts

What’s In Your Powershell Profile?

Shane O’Neill wants to know what’s in your Powershell profile: This brings me back to the main point. My profile does 3 things Changes the default colour of error and warning messages, Sets an alias for notepad to “n” since I use it so much Set-Alias -Name n -Value notepad , and loads up the dbatools prompt […]

Read More

Policing Database Deployments

Drew Furgiuele has a rather interesting library that he’s released to the general public: The base return is the TSQLFragment object, which in turn has a Batches object, which in turn holds… well it can hold a lot of different things. When the text is parsed, it will determine what type of object to return based […]

Read More

Categories

January 2016
MTWTFSS
« Dec Feb »
 123
45678910
11121314151617
18192021222324
25262728293031