OpenVMS and PowerShell scripts

Follow

JAMS for OpenVMS can easily run PowerShell scripts on a Windows platform. To do this, create an execution method for PowerShell. This article walks through the steps to create this execution method.

First, on the OpenVMS JAMS server, create a text file named PowerShell.txt which contains this:

#
# JAMS for OpenVMS PowerShell template
#
$JAMS_Entry = "<<JAMS_ENTRY>>"
$JAMS_JobName = "<<JAMS_JOB_NAME>>"

<%PSPARAM(PARAMETER)%>

<%JAMS_JOB%>
exit

 

Next, create a text file named PSPARAM.TXT which contains:

$<<NAME>> = <<QVALUE>>

 

Now, load these two file into the JAMS Template text library with these commands:

 

$ LIB/INSERT/TEXT JAMS_DATA:JAMS_TEMPLATE POWERSHELL.TXT
$ LIB/INSERT/TEXT JAMS_DATA:JAMS_TEMPLATE PSPARAM.TXT

 

The last step is to create a PowerShell Execution Method with this command:

 

$ MCR JAMS_EXE:JAMS_MASTER.EXE CREATE METHOD POWERSHELL/TYPE=AGENT -
/DESCRIPTION="Windows PowerShell Job" -
/JOB_MODULE=POWERSHELL -
/COMMAND="POWERSHELL.EXE -InputFormat none -NonInteractive -File ""%s""" -
/EXTENSION=PS1 -
/PROCEDURE=JAMS_COM:JAMS_REQUESTER.COM

 

Be careful with the quotes that surround the %s, there are two double quotes before it and three double quotes after it.

Now, JAMS can create a Job that uses the PowerShell Execution Method with a PowerShell source. The template will define a PowerShell variable for each of the Jobs Parameters along with a few JAMS variables (Entry Number, Job Name etc.).

Have more questions? Submit a request

Comments