Check Agent Job Status From Different Servers with Powershell


 

Rob Swell has a handy script to retrieve agent job running status from multiple servers.

You can find the script from his bolg.

How I Check Hundreds of SQL Agent Jobs in 60 Seconds with Powershell

 

You just need to update the file location  and server list (one server in one line text file) and run the script from Powershell window. You will get an Excel file open to show your the slow moving progress.

If you want to use this script to run as an agent job, you may need to set proper permission to allow powershell user through agent job to access Excel COM.

Here is how to change the Identity to The interactive user:
From Administrative Tools>>Component Services > Computers > My Computer > DCOM Config >> Microsoft Excel application (right click ) > Properties
> Identity > Select The Interactive User  (by default, it was The launching user) >  Click OK.

 

Advertisements

One Comment on “Check Agent Job Status From Different Servers with Powershell”

  1. Hi, thank you that’s a good tip. I am glad that people are still using the scripts from that old post and hopefully you have seen the newer post https://sqldbawithabeard.com/2015/09/28/power-bi-powershell-and-sql-agent-jobs/ The code for the DBA Database and the scripts to gather information are on GitHub https://github.com/sqldbawithabeard

    also the new SSMS release tomorrow will have new cmdlets for SQL Agent
    Get-SqlAgent Returns a SQL Agent (JobServer) object that is present in the target instance of the SQL Server.
    Get-SqlAgentJob Returns a SQL Agent Job object for each job that is present in the target instance of SQL Agent.
    Get-SqlAgentJobHistory Returns the JobHistory present in the target instance of SQL Agent.
    Get-SqlAgentJobSchedule Returns a JobSchedule object for each schedule that is present in the target instance of SQL Agent Job.
    Get-SqlAgentJobStep Returns a SQL JobStep object for each step that is present in the target instance of SQL Agent Job.
    Get-SqlAgentSchedule Returns a SQL JobSchedule object for each schedule that is present in the target instance of SQL Agent.

    You can read more about that here https://blogs.technet.microsoft.com/dataplatforminsider/2016/06/30/sql-powershell-july-2016-update/ and see more about here
    http://sqlvariant.com/2016/06/webinar-on-25-new-powershell-cmdlets-for-sql-server-and-more/


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s