Created
January 21, 2016 19:38
-
-
Save MikeFal/df2e2b0b5405f8cd5250 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[System.Reflection.Assembly]::LoadWithPartialName('Microsoft.SqlServer.SMO') | out-null | |
$InstanceName = 'localhost' | |
$errlogs = (New-Object Microsoft.SqlServer.Management.Smo.Server $InstanceName).JobServer.EnumErrorLogs() | |
$FullLog = @() | |
$errlogs | ForEach-Object {$FullLog += $smosrv.JobServer.ReadErrorLog($_.ArchiveNo)} | |
$FullLog | Sort-Object LogDate -Descending |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment