Skip to main content

Hi Team,

I am trying to run the workflow using PowerShell and capture the workflow job id output to the text file, that text file will be read by our BigFix tool. 

Below is the scripts and the error i am getting

PS C:\Users\awilliamtell> $jobid = Start-CVWorkflow -name baas_workflow -Force | select jobid
INFO: Start-CVWorkflow: enter inputs for workflow wbaas_workflow]
PS C:\Users\awilliamtell> qlist job -cs BTEEGVPCSTVW001.forsythehosting.com -j $jobid -waitForJobComplete -waitTimeoutSe
cs 600 | out-file -filepath c:\test\test.txt -append
job: Error 0x303: Invalid job Id @{jobId=18850}

 

**************************************************************************************************

I tried to print the $jobid and if its giving output as Can't find file @{jobId=18866; processId=18866}

PS C:\Windows\system32> $jobid = Start-CVWorkflow -name baas_workflow -Force
INFO: Start-CVWorkflow: enter inputs for workflow obaas_workflow]
PS C:\Windows\system32> print ($jobid)
Can't find file @{jobId=18866; processId=18866}
 

Any help will be great! 

Hi Allan,

PS C:\Windows\system32> $jobid = Start-CVWorkflow -name baas_workflow -Force
INFO: Start-CVWorkflow: enter inputs for workflow [baas_workflow]
PS C:\Windows\system32> print ($jobid)
Can't find file @{jobId=18866; processId=18866}
 

Print in powershell is done via a command called Write-Host.  The function Print() maybe calling a Printer related function.

Output of the Start-CVWorkflow command is an object which contains jobId and processId. Reference API : https://documentation.commvault.com/11.24/essential/49452_executing_workflow_as_api_rest_api_get.html

We can use it like this

 $output = Start-CVWorkflow -name baas_workflow -Force | select jobid
INFO: Start-CVWorkflow: enter inputs for workflow lbaas_workflow]

$jobId = $output.jobId


Reply