Skip to main content
Solved

Help with powershell Script

  • September 14, 2022
  • 1 reply
  • 259 views

Forum|alt.badge.img+13

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 [baas_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 [baas_workflow]
PS C:\Windows\system32> print ($jobid)
Can't find file @{jobId=18866; processId=18866}
 

Any help will be great! 

Best answer by JnaneshD

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 [baas_workflow]

$jobId = $output.jobId

View original
Did this answer your question?

Forum|alt.badge.img
  • Vaulter
  • September 15, 2022

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 [baas_workflow]

$jobId = $output.jobId


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings