Users may encounter situations where PowerShell scripts that run successfully outside of JAMS do not run successfully inside of JAMS, or do not run at all and produce no error messages. In those situations, it is possible that the scripts fail in JAMS because of assembly issues.
To resolve these issues and ensure the script runs successfully, users should leverage the Execution Method Property, Host Sub Directory, available in JAMS V7.0.1561 and later.
NOTE: To ensure proper functionality, users must upgrade all JAMS Servers and all JAMS Agents to V7.0.1561 or later.
The Host Sub Directory Property points an Execution Method to look for assemblies in a subfolder under the Scheduler folder (when running on the Scheduler), or under the Agent folder (when running on JAMS Agents). For the PowerShell Execution Method, a new PSHost directory is created in JAMS V7.0.1561 and later.
Upgrades to V7.0.1561 will create the PSHost subdirectory, but will not automatically set the Host Sub Directory Property. Users upgrading to V7.0.1561 should create a new custom PowerShell Execution Method to reference the PSHost subdirectory, and use that new Execution Method on the Jobs that were not executing as intended. Instructions to create an Execution Method are available below.
Users who have a "Fresh" installation of JAMS V7.0.1561 or later (where the JAMS scheduler did not exist before V7.0.1561 or later was installed) will automatically have the Host Sub Directory of their PowerShell Execution Method reference the PSHost subdirectory.
NOTE: Users that rely on custom assemblies in their PowerShell scripts may need to copy those assemblies into the PSHost subdirectory.
Creating a Custom PowerShell Execution Method to reference PSHost
NOTE: Users should only create a custom PowerShell Execution Method if they upgraded to JAMS V7.0.1561 from a previous version of JAMS V7.X. Users upgrading to JAMS V7.0.1561 or later from JAMS V6.X will have the Host Sub Directory Property set on the base PowerShell Execution Method.
- Navigate to the Execution Methods Shortcut.
- Use the Add button to open the Add an Execution Method dialog.
- Set the new Execution Method's Name and Description (optional) as desired. Use PowerShell as the Base Method.
- Click Ok. The Execution Method Properties dialog will open by default.
- Select the Properties tab, then set the Host Sub Directory Property to PSHost.
- Make any other desired changes to the new Execution Method, then click Save & Close.
- Update the desired Jobs to use the new Execution Method.
Comments