How to read SQL Agent logs using Windows PowerShell

Prerequisite: SQL Management Studio needs to be installed [sourcecode language=”powershell”] [System.Reflection.Assembly]::LoadWithPartialName(‘Microsoft.SqlServer.Smo’) | Out-Null $Sql = New-Object (‘Microsoft.SqlServer.Management.Smo.Server'<strong>)”<SQL Instance Name>”</strong> $SQLAgent = $Sql.JobServer $SQLAgent.ReadErrorLog() | format-list * [/sourcecode]  

Continue reading
%d bloggers like this: