I can easily read the SQL Error Logs using the below code but cannot find a way to read the Agent Error Logs. Does anyone know if it is possible?
$sqlServer = new-object ("Microsoft.SqlServer.Management.Smo.Server") $server
$sqlServer.ReadErrorLog()
I’ve searched through the namespaces and there isn’t anything obvious pointing me to the logs. I have tried this without success.
$sqlAgent = new-object ("Microsoft.SqlServer.Management.Smo.Agent") $server
$sqlAgent.ReadErrorLog()
@Pondlife was correct. For anyone else facing this problem, this worked for my purposes.