Community forum

Please note that VisualCron support is not actively monitoring this community forum. Please use our contact page for contacting the VisualCron support directly.


TS
  •  TS
  • Paid support Topic Starter
2012-07-09T10:32:39Z
Hello,

We need to launch Powershell script with arguments, but I'm not able to pass arguments on Powershell Task Type

It is possible to add an arguments field like "Execute" tasks on "Powershell" tasks ?

thanks
Sponsor
Forum information
Support
2012-07-09T11:33:39Z
Ok, that should not be a problem adding.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
2012-07-11T16:09:24Z
It would be sweet if we can add a visualcron variables as parameters after the called script as a powershell script file. Such as below:

C:\scripts\powershellscript.ps1 {TRIGGER(Active,LastTrigger,File.Result.Name)} {TASK(bc897f8e-492a-4b82-a591-1eff3be8534e,StdOut)}


Or embedded in a powershell script text:
$triggerfile = {TRIGGER(Active,LastTrigger,File.Result.Name)}
$releasestring = {TASK(bc897f8e-492a-4b82-a591-1eff3be8534e,StdOut)}
osirisja
2012-07-11T18:01:28Z
Hi Steve

That already works (embedded variables). I run PoSH scripts like this:

$prof = "{USERVAR(@DPrf)}"
$docdef = "{USERVAR(@DocDef)}"
$inpfil = "{USERVAR(@Infile)}"
$outfil = "{USERVAR(@ClientRoot)}\vctestdflt.AFP"
$logfile = "{USERVAR(@ActLog)}"
#$logfile = "C:\@VC\log\powershell.lint"
$exe = "c:\isis_v72\pdew3700\pdew3.exe"

$prjstr = "/compile /profile=$prof /docdef=$docdef /input=$inpfil"

$a = "$exe $prjstr"

Invoke-Expression $a | Out-File $logfile


Cheers

Andy
Support
2013-12-19T13:47:15Z
We have now implemented parameter support in the PowerShell Task. Will be presented in the next version.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
bweston
2013-12-19T21:28:53Z
What I've been doing when I needed this is using the powershell script box and dot-sourcing my script. Well, actually, in those cases, I write a function in the script, dot-source it, and then call it, rather than giving the script parameters directly.
Support
2013-12-19T22:20:44Z
Originally Posted by: bweston 

What I've been doing when I needed this is using the powershell script box and dot-sourcing my script. Well, actually, in those cases, I write a function in the script, dot-source it, and then call it, rather than giving the script parameters directly.



Yes, I know about the workaround, and I think that is a good alternative. But this might be more straight forward for some users, especially for those who do not want to touch their scripts.
Henrik
Support
http://www.visualcron.com 
Please like  VisualCron on facebook!
Scroll to Top