JAMS 6.x Help
JAMS PowerShell Export-Import Cmdlets

You can export and import Jobs, Setups, folders, triggers, variables, etc., with the JAMS PowerShell Module as well as its Export-JAMSXml and Import-JAMSXml cmdlets.  

Note: This export-import process is handled differently depending if you are using JAMS v.6.x or not.

Note: We recommend importing any resources, variables, users, queues, agents, and dates first. Then systems (using JAMS v. 5.4 only), then Jobs and finally, Setups.  

The reason for this is that if you try to import a Job that references a user or queue, for example, it will not be able to create the Job without those objects already being in place, thus causing an error.

Note: You will not be able to access certain functions unless you are running JAMS as a local administrator. To do this, right-click on the PowerShell shortcut and select the command: “Run as Administrator”.

Below are four sets of examples that can be used based on the version of JAMS you are currently using.

Exporting to or Importing from JAMS v. 6.x or Later

Export Example

Exporting to JAMS 6.x or Later
Copy Code

#Import the JAMS Module

Import-Module JAMS

 

# Get a list of all Jobs in a Folder within JAMS

$job = Get-ChildItem JAMS::localhost\FolderName\*

 

# Export all Jobs to XML

Export-JAMSXml C:\temp\file.xml $job

Import Example

Importing from JAMS 6.x or Later
Copy Code

# Import Jobs, etc in XML to JAMS, first setting the location (Folder) in JAMS v6.0 where you want the import to be placed

Set-Location JAMS::localhost\FolderName\

$filepath = c:\temp\file.xml

Import-JAMSXml $filepath

Exporting to JAMS v. 5.4 or Earlier and Importing from JAMS v. 6.x or Later

Export Example

Exporting to JAMS 5.4
Copy Code

#Import the JAMS Module

Import-Module JAMS

 

# Get a list of all Jobs in a JAMS System

$job = Get-ChildItem JAMS::localhost\Systems\JAMS\Jobs\*

 

# Export all Jobs to XML

Export-JAMSXml C:\temp\file.xml $job

Import Example

Importing to JAMS 6.x
Copy Code

# Import Jobs, etc in XML to JAMS, first setting the location (Folder) in JAMS v6.x where you want the import to be placed.  JAMS v6.x will ignore the <SystemName></SystemName>

# section of the export from v5.4 and will import in to the Folder specified in the Set-Location command below

 

#Import the JAMS Module

Import-Module JAMS

 

Set-Location JAMS::localhost\FolderName\

$filepath = c:\temp\file.xml

Import-JAMSXml $filepath

Exporting to and Importing from JAMS v. 5.4 or Earlier

Export Example

Exporting to JAMS 5.4
Copy Code

# Get a list of all Jobs in a JAMS System

$job = Get-ChildItem JAMS::localhost\Systems\JAMS\Jobs\*

 

# Export all Jobs to XML

Export-JAMSXml C:\temp\file.xml $job

Import Example

Importing from JAMS 5.4
Copy Code

#Add the JAMS snapin

Add-pssnapin MVPSI.JAMS

 

# Import Jobs, etc in XML to JAMS

$filepath = c:\temp\file.xml

Import-JAMSXml $filepath

Exporting from JAMS v. 6.x or Later and Importing to JAMS v. 5.4 or Earlier

Export Example

Exporting from JAMS 6.x
Copy Code

# Get a list of all Jobs in a Folder within JAMS

$job = Get-ChildItem JAMS::localhost\FolderName\*

 

# Export all Jobs to XML

Export-JAMSXml C:\temp\file.xml $job

Import Example

Importing to JAMS 5.4 
Copy Code

#Add the JAMS snapin

Add-pssnapin MVPSI.JAMS

 

# Import Jobs, etc in XML to JAMS

$filepath = c:\temp\file.xml

Import-JAMSXml $filepath

Note: You will first need to edit the xml file that you exported in order to add the name of the System that the Job will be imported to in JAMS v 5.4 or earlier.  To do this, edit the xml file in a text editor such as Notepad and add <SystemName>NameOfJAMSSystem</SystemName> as an additional attribute inside of the <Job></Job> section. 

About the JAMS Command Line Environment (JAMS.exe)

The JAMS Command Line Environment (JAMS.exe) allows users to export and import Job and Setup definitions in JAMS, in addition to many other capabilities. However, it must be noted that JAMS.exe was designed to work with JAMS v. 5.x and is now considered a legacy feature.

As described in this topic JAMS PowerShell Cmdlets should be used to import and export all Jobs, Setups and other JAMS objects going forward. 

 

See Also

 

 


Topic updated: 10/29/2015
©2017 MVP Systems Software, Inc. All Rights Reserved.

Send comments on this topic.