Passing Parameters from VC into PowerShell script - VisualCron - Forum

Community forum

Eddie Kumar
2019-03-12T19:01:57Z
Hi,

We are unable to access the Parameters set in the Parameter window-pane in the PowerShell script.

I referred to the documentation  but it didn't help.

I did as documentation advised to no avail:
Click on Parameters button to edit parameters. You can parse parameters in the PowerShell script like this:
param (
[string]$parameterkeyname1 = "mydefaultvalue1",
)
Write-Output $parameterkeyname1
Params in PS.PNG
TIA.
Gary_W
2019-03-12T19:29:56Z
Based on your parameter, the code should be like this since you are setting the path in the parameter:

param (
[string] $File_Path
)
Write-Output $File_Path
Eddie Kumar
2019-03-13T09:50:43Z
Originally Posted by: Gary_W 

Based on your parameter, the code should be like this since you are setting the path in the parameter:

param (
[string] $File_Path
)
Write-Output $File_Path



Thanks Gary, it's working now. Appreciate your help.
Thx.
Gary_W
2019-03-13T13:59:59Z
My pleasure. The power comes in passing visualcron variables in the Value side of the parameter. Your File_Path value could be {TRIGGER(Active|LastTrigger|File.Result.FullPath)} for instance, the full path of the file that caused the trigger to fire for the current job.

See this post for a useful example of this, passing a filename to a powershell function that counts lines: http://www.visualcron.co....aspx?g=posts&t=9301 
Scroll to Top