Jump to content

Custom Powershell Input and output parameters - how to pass to script


Recommended Posts

Posted

Hi All,

Hopefully a really simple answer (I had a look through the forum\docs and couldn't see an answer), I'm trying to do a proof of concept with the powershell custom script where I am passing a variable, see the attached screen shot.

I've set up a script which runs however no parameters are passed, for example my script starts with the below as your would setup if you passing an argument into a ps1 script:

# Parameters

param (
    [string]$SAMname,
    [string]$CRNumber,
    [string]$CROpenDate
)
Write-host "sam name below.."
Write-host "Sam Name - $SAMname"
Write-host $SAMname

As you can see in the attached I have a variable entered but nothing is passed. 

If I don't specify param then I get similar behaviour.

Is there something I am missing?

Thanks

Hornbill-input variables.png

2024-07-01 11_28_46-Job Queue _ Job 21 _ Access Opener v5.png

Posted

Hi @Daniel_idx,

The operation input params are not automatically sent, as they may not match what's in the script. You need to add them to the options / args section of your operations too:

image.png

Then you'll be able to access the params in your script:

image.png

 

Hope this helps,

Steve

  • Thanks 1
Posted

Hi Both,

Thanks for the quick responses - For inputs - Steve's answer was what I was missing and made the script work perfectly!

I've not played around with it yet but for the output say I wanted to output $ServerList for example would I need to add something like this?
 

Write-host {{SISJobOutputParameterStart:ServerList}}"SeverA,ServerB"{{SISJobOutputParameterEnd}}

And add the below?

Thanks!

Screenshot 2024-07-01 153004.png

Posted

HI @Daniel_idx, Yes that would enable you to refer to the value using a hornbill variable called "ServerList", which can be used within a Horbbill Workflow.

Ricky.

Posted

Hi @Ricky - thanks for confirming will work out the background logic and give it a try.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...