Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 5123

SQL Agent jobs status for multiple servers using Powershell.

$
0
0

Hi All,

I am following website link: http://www.toadworld.com/platforms/sql-server/b/weblog/archive/2013/09/17/powershell-script-to-monitor-a-service-on-a-group-of-servers-html-formatted-email-output.aspx

I require to gather status details about all the SQL Agent jobs in the environment on multiple SQL Servers.

I tried to edit the script using:

[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SqlServer.SMO")
$sqlServerName = 'localhost\developer'
 
$sqlServer = New-Object Microsoft.SqlServer.Management.Smo.Server($sqlServerName)
 
foreach($job in $sqlServer.JobServer.Jobs)
{
    $job | select Name, OwnerLoginName, IsEnabled, LastRunDate, LastRunOutcome, DateCReated, DateLastModified
}

but SQL Agent jobs are not reflecting in the mail output...

requesting help...!!

Thanks in Advance.

Hunt


Viewing all articles
Browse latest Browse all 5123

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>