How to create a job with a parameter and other properties set



###  Add the JAMS Provider Drive
New-PSDrive JD JAMS localhost

### Use new-item to create job, specify which folder you wish to create in
$job1 = new-item JD:\Samples\MyNewJob -ItemType Job

###Add properties
$job1.BatchQueueName = "LoadBalance" 
$job1.Description = "AXCIS file processing." 
$job1.UserName = "JAMS" 
$job1.SubmitMethodName = "Command" 
$job1.Source = "DIR C:\" 

$prm = new-object MVPSI.JAMS.Param
$prm.ParamName = "JAMSTraceLevel"
$prm.DefaultValue = "Verbose"
$prm.DataType = [MVPSI.JAMS.DataType]::Text
$prm.Length = 10

####Update the job after it is created


Have more questions? Submit a request


  • Avatar
    Alex Taylor

    How to add job dependencies?

  • Avatar
    Alex Taylor

    How to list properties for $job1 ?

  • Avatar
    Daniel St Jean

    Hi Alex,

    Here is an example of adding dependencies to a job using PowerShell.

    $job = Get-ChildItem JD:\Systems\Samples\Jobs\Attachlog
    $Depends = new-object MVPSI.JAMS.DependencyFile
    $Depends.FileName = "C:\MyFile.txt"
    $Depends.FilePresence = "Available"

    $Depends = new-object MVPSI.JAMS.DependencyJob
    $Depends.Job = Get-ChildItem JD:\Systems\Samples\Jobs\SampleFailedJob
    $Depends.CompletionSeverity = "Info"

    $job = Get-ChildItem JD:\Samples\Attachlog
    $Depends = new-object MVPSI.JAMS.DependencyVariable
    $Depends.Variable = Get-ChildItem JD:\Samples\MyNEWVar
    $Depends.CompareCondition = "Equal"
    $Depends.CompareValue = "Sally Smith"

    You could get job properties using Get-Childitem.

    Import-Module JAMS
    #LocalHost is the name of the JAMS server.
    cd JAMS::localhost\Samples
    #Attacklog is the job properties being retrieved.
    Get-ChildItem Attachlog | Format-List