I need to pass one argument to my powershell script in Tidal Orchestrator. c:\script.ps1 "argument". Argument is hidden string
How should I enter an argument in the "Script Arguments" field?
I tried a lot of combinations but nothing works. Tidal activity doesn't pass argument to powershell script at all.
It only works if I pass it in "Script to execute on target" field. But it's not what I want. I can not pass hidden string in this field.
Any suggestions are welcome.
Go to Solution.
The issue may be with the use of double quotes around the parameter, which you would understandably want for a password.
Have a look at the TAP here:
It doesn't pass a parameter in Invoke-Expression, but you can.
Change the Execute Windows PowerShell Script activity to have two parameters, one that is the scriptname and one that is the securestring. The script should look like this:
Invoke-Expression "C:\script.ps1 `'$SecureString`'"
#End of code snippet
The $SecureString can be passed in using the "Script Arguments" field as Christopher (aka Shaun) showed.
The issue with quotes is handled by escaping the quotation marks around the secure string. That's
Double-Quote ScriptName Backtick Single-Quote $SecureString Back-Tick Single-Quote Double-Quote
View solution in original post
Script to execute on target is the powershell script itself. Why is this not valid for you? What is the requirement to call the script and not have the script in the script box?
If you put something in the script arguments box (using your hidden string). You should be able to reference the arguments array.
Here is a sample of some timezone code I wrote today with 7 arguments passed in...
$date1 = New-Object System.DateTime $args, $args, $args, $args, $args, 0
$TZ1 = $args
$DTFormat = $args
$tz = [System.TimeZoneInfo]::FindSystemTimeZoneById("$TZ1");
$outputAdd = $output.AddSeconds($args)
$out = $outputAdd.ToString("$DTFormat")
I realize I wrote mine in there directly and did not export it to a separate PS1 file, but there was no need.
Can you do...
in your script field? And then make the argument a hidden string in the script arguments box?
It that does not work for you, you might investigate calling powershell directly through the windows execute activity, but I think it should work via powershell activity.
If nothing ends up working, I would suggest opening a case with TAC to capture the use-case for engineering.
Thank everybody for your answers. I pasted content of the script in "Script to execute on target" field and it works now. It didn't work because I used windows path to PS1 file in this field.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: