Monday, March 6, 2017

Favorite JAMS Powershell Code

At the company where I work, we use a job automation system called JAMS by MVP Software Systems (www.jamsscheduler.com).  JAMS is above and beyond the abilities of the local Task Scheduler.  I recommend you take a look at the software and talk to the support people.

One of the many things I like about JAMS is the ability to use PowerShell to administer and gather information from JAMS.  Here are a couple of code snippets I use a lot for getting information from JAMS:

Get job information:
I have been asked, many times, for information on specific jobs based on the different systems we use.  In this example, the code will pull the job name, scheduled time, submit method for specific jobs

Invoke-module JAMS

New-PSDrive JD Jams <JAMS server name>
Get-ChildItem JD:\ -ObjectType job -IgnorePredefined -Recurse | select jobname, scheduledtime, submitmethodname

Here is the output after running the above script:
 

There is a large list of attributes for a job.  To see all the available attributes, run the following code:

Invoke-module JAMS

New-PSDrive JD Jams <JAMS server name>
Get-ChildItem JD:\JAMS -ObjectType job -IgnorePredefined -Recurse | FL

In the example above, I chose JD:\JAMS so you get a smaller list of jobs in the output.

Get scheduled job information
The previous example gathers information from all jobs that have been created in JAMS.  The following example will gather information for jobs that are currently scheduled to run.  The output will be the name of the job, which server (agent) the job will be ran against, and the user name that the job will run as.

Get-JAMSEntry -Server <server name> | Select name,agentnode,username

I would post an example but there is some confidential information I cannot divulge.

So, I hope you find these scripts helpful.  Also, give JAMS a try.

No comments:

Post a Comment