Passing arguments to a workflow

Last post 03-12-2019, 1:58 PM by TCarroll. 0 replies.
Sort Posts: Previous Next
  • Passing arguments to a workflow
    Posted: 03-12-2019, 1:58 PM

    Hi All,

    What I'm trying to do is pass the clientname and hostname from a powershell script to a workflow. It is a very simple script that configures the client. What i would like to do is execute a workflow as a job and do the same work. If I use this same bit of code in a worflow (inputXML value) it runs fine also. 

    So, my question is, how do I use a simple ps script to pass the clientname/hostname to a defined workflow?

    Here is the .ps1 code.

    foreach ($newclient in $Clients)  
    Write-Host "Registering $newclient"

    $body = "





    $command = Invoke-WebRequest -Uri "$webServer/QCommand/qoperation execute" -Headers $headers -Method POST -Body $body
    If I run this, the workflow fails, but the Input values are recognized in the Job details under properties.

    $Result = Invoke-RestMethod -Method GET -Uri "$webserver/wapi/API Create Unix Client?clientName=tec-test6&" -Headers $headers

    Error Code: [19:857] Description: execution of command resulted in exitCode [3] Source: essprodcs, Process: Workflow

    What I was missing: Setting the commandArgs field
    -clientName xpath:{/workflow/inputs/clientName} -hostName xpath:{/workflow/inputs/hostName}
The content of the forums, threads and posts reflects the thoughts and opinions of each author, and does not represent the thoughts, opinions, plans or strategies of Commvault Systems, Inc. ("Commvault") and Commvault undertakes no obligation to update, correct or modify any statements made in this forum. Any and all third party links, statements, comments, or feedback posted to, or otherwise provided by this forum, thread or post are not affiliated with, nor endorsed by, Commvault.
Commvault, Commvault and logo, the “CV” logo, Commvault Systems, Solving Forward, SIM, Singular Information Management, Simpana, Commvault Galaxy, Unified Data Management, QiNetix, Quick Recovery, QR, CommNet, GridStor, Vault Tracker, InnerVault, QuickSnap, QSnap, Recovery Director, CommServe, CommCell, SnapProtect, ROMS, and CommValue, are trademarks or registered trademarks of Commvault Systems, Inc. All other third party brands, products, service names, trademarks, or registered service marks are the property of and used to identify the products or services of their respective owners. All specifications are subject to change without notice.
Copyright © 2020 Commvault | All Rights Reserved. | Legal | Privacy Policy