1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
| [void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO")
$sqlServerName = '*******'
$sqlServer = New-Object Microsoft.SqlServer.Management.Smo.Server($sqlServerName)
foreach($job in $sqlServer.JobServer.Jobs)
{
$job | select Name, OwnerLoginName, IsEnabled, LastRunDate, LastRunOutcome | format-table
}
# Script to Display information about the Jobs installed on the Server
# Lists Owner, Status, Creation Date and the Date Last Modified
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO")
$sqlServerName = 'QUAAWSSQL11\CLU01'
$sqlServer = New-Object Microsoft.SqlServer.Management.Smo.Server($sqlServerName)
foreach($job in $sqlServer.JobServer.Jobs)
{
$job_name=$job.name
$lisjob="DatabaseBackup -DATABASES - LOG","DatabaseBackup -DATABASES - FULL","Maintenance Database"
if ($job_name -contains $lisjob)
{
$job | select Name, IsEnabled, LastRunDate, LastRunOutcome, DateCReated, DateLastModified |Format-Table
}
} |
Partager