IT Process Automation

Expand all | Collapse all

Run_Script_1 - Powershell script- How to use Operator parameters

Jump to Best Answer
  • 1.  Run_Script_1 - Powershell script- How to use Operator parameters

    Posted 11-30-2018 09:23 AM

    Hi Community,

     

    CA Process Automation Service Pack 04.3.03

     

    I am using the run_script operator to run the a piece of powershell script on remote machine. I have defined the host names in Parameters section of the operator as below

     

     

    I am looking for a way to use the "defined operator parameters" in the Inline script,  any inputs on how to use the  values of parameters in the inline script.

     

    Thank you,

    Regards,

    Venkat



  • 2.  Re: Run_Script_1 - Powershell script- How to use Operator parameters
    Best Answer

    Posted 11-30-2018 10:02 AM

    Hi CodeGeek,

     

    Try this:

     

    param($server1, $server2)

    hostname $server1

    hostname $server2

     

    Regards,

    Sérgio Castro



  • 3.  Re: Run_Script_1 - Powershell script- How to use Operator parameters

    Posted 12-06-2018 09:34 AM

    Hi,

     

    Just as a special note, you have to be careful what the content is of the variables you pass to PowerShell are.

     

    Some characters will cause PowerShell to not parse the input properly, I have often found that to be a problem with complex passwords that use special characters.

     

    Sometimes you can avoid this by wrapping the variables in single quotes, but not always.

     

    Hope this helps,

    Ian