Quantcast
Viewing all articles
Browse latest Browse all 1519

Powershell sql agent jobs

Hi, I am trying to check status of sql agent jobs on various servers using powershell howerver I successfully list all the servers but cant seem to be able toWrite-Output$job.namefor any of the servers including the monitoring server that I am absolutely sure I have all required permissions. I get no errors which makes troubleshooting that much more difficult. Any ideas? Thank you

...

 foreach($sqlserverin$sqlservers)

{

#***THIS WORKS***

write-host$sqlserver.instancename

$srv=New-Object ('Microsoft.SqlServer.Management.Smo.Server')$sqlserver;

foreach ($jobin$srv.Jobserver.Jobs)

{

$jobName=$job.Name;

$jobEnabled=$job.IsEnabled;

...

#***THIS DOESN'T WORK***

write-host $jobName 

write-host $job.Name 

...


Paula



Viewing all articles
Browse latest Browse all 1519

Trending Articles



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