7 followers Follow

importing jobs between dev,test,prod environments

To move a job set from dev to test domains, I run these powershell commands:

import-module jams

$job = get-childitem jams::localhost\<folder>\* -objecttype job

export-jamsxml  D:\work\jams\jobs.xml $job

## copy jobs.xml to the host with JAMS test server

set-location JAMS::localhost\<folder>

import-jamsxml d:\xinstall\jobs.xml


My problems is when a job has a dependency on a job that has not been defined, for example:

<Job name="job_send_cheques_for_payment">

      <Dependency xsi:type="DependencyJob" job="job_create_cheques">

job_send_cheques_for_payment  will not import, till job_create_cheques has been defined.

Has anyone got some hand code to work around this? (dicking around with the jobs.xml is too time consuming)


Alex Taylor

Official comment


Hello Alex, 

In order to import the job, the dependency job must exist before the job with the dependency is imported. This requirement is to ensure that no broken references are created. With that said, your script will have to go out and find the dependency job, export it to XML, then export the job that depends on it. The import process must then start in the reverse order. Import the dependency jobs, then import the jobs with that dependency. This would also be the same for any other references that would exist, such as batch queues, JAMS users, and setup jobs, for example.

Gennaro Piccolo
Comment actions Permalink

Please sign in to leave a comment.



Using the JAMShr libraries in a C# project I have had success creating a job stub.  I create all folder, then variables, then jobs creating a job without any of the elements parameters or source if it does not exist.  I then do a second pass to add the elements parameters and source to my jobs without worrying about dependencies.  There is no reason a similar tactic could not be taken using PowerShell.  

Jared Stroebele 1 vote
Comment actions Permalink

We did what Jared said below and removed all dependencies from the xml then imported that one first then the original xml's.

Logan Probst 0 votes
Comment actions Permalink