When you have many Jobs in JAMS V7, you may need to make the same change in multiple Jobs. You can make these changes by using the PowerShell scripts in this article. You can change the following properties on a Job:
- The Agent
- The Execute As user (Job username)
- The Batch Queue
- The Resource
- The required quantity for the Resource
Scripts
To make these changes as part of the Change All functionality, you need to run two scripts that are attached to this article.
- ChangeMethod.xml - Adds an Execution Method in JAMS to run the new ChangeAll Job.
- ChangeJob.xml - Adds a Job named ChangeAll to the JAMS folder. You can specify another folder if needed.
These scripts need to be run only once to add them into the JAMS environment.
Importing the ChangeAll Execution Method and Job into JAMS
Before you can use the Change All functionality, you need to download and run two script files.
NOTE: These scripts need to run only once on the JAMS Client. After the Execution Method and Job have been imported, follow the steps in the Running the ChangeAll Job section below.
- On the JAMS Client machine, download the ChangeMethod.xml and ChangeJob.xml file from the bottom of this article.
- Save the files to a location on the JAMS Client, such as C:\.
- Search for the Windows PowerShell ISE application on your JAMS Client machine.
- Right-click Windows PowerShell ISE and select Run as administrator.
- Click File | New.
- In the script below, update the -Path parameter to use the location where the ChangeMethod.xml file is saved, and update the -Server parameter to use the server name of the JAMS Scheduler.
Import-Module JAMS -ErrorAction SilentlyContinue
Import-JAMSXml -Path "C:\ChangeMethod.xml" -TargetFolder "\Methods" -Server "Server1" - Click File | Run.
- Click File | New.
- In the script below, update the -Path parameter to use the location where the ChangeJob.xml file is saved, and update the -Server parameter to use the server name of the JAMS Scheduler.
Import-Module JAMS -ErrorAction SilentlyContinue
Import-JAMSXml -Path "C:\ChangeJob.xml" -TargetFolder "\JAMS" -Server "Server1" - Click File | Run.
- Open JAMS.
- Click Definitions from the Shortcuts menu.
- Click a Folder under the Folder Navigator.
- Right-click any column heading and select Column Chooser. The Customization dialog is displayed.
- Double-click Qualified Name to add it as a column.
- Close the Customization dialog.
Running the ChangeAll Job
After the two scripts run successfully, you can use the ChangeAll Job in JAMS to modify existing Jobs.
When you run the ChangeAll Job, it changes the specified properties at the Job-level only. For example, it will not change a Batch Queue property that is specified in a Schedule Item on that Job.
- Click Definitions from the Shortcuts menu.
- Go to the Folder that has the Jobs that you want to modify.
- Use the Ctrl or Shift keys to select one or more Jobs.
- Click Ctrl + C to copy the selected Jobs.
- Go to the Folder where the ChangeAll Job is saved. By default, this is in the JAMS folder.
- Right-click the ChangeAll Job and select Submit.
- Click the Source tab.
- In the Source text area, click Ctrl + V to paste the list of Jobs onto the Source tab.
- Click the Parameters tab.
- Select the appropriate checkboxes and update the values in the fields as needed. You can change:
- AgentName – Change the Agent that is specified in the selected Jobs to another Agent.
- ExecuteAsName – Change the Execute As user that is specified in the selected Jobs to another username.
- BatchQueueName – Change the Batch Queue that specified is in the selected Jobs to another Batch Queue.
- ResourceName – Change the Resource that is specified in the selected Jobs to another Resource. If you enter the name of another Resource, it will be added as a second Resource Dependency on the Job rather than replacing the existing Resource Dependency.
- QuantityRequired – Change the number of Resources that are currently required.
- Click Submit Run Request.
- Click OK on the Submit Job dialog.
- Click Monitor from the Shortcuts menu.
- Verify the Job completed with a status of Success.
Comments