0

I have a PowerShell script which needs to invoked via controlM. Sample invocation looks like

powershell -NoLogo -NonInteractive -Command "D:\path\to\Whatever.ps1 -param1 %%PARAM1 -param2 %%PARAM2"

The value for param2 is a CSV like '1111111,2222222' and typically spans nearly .5 million chars long.

Issue: There is a limitation in controlM that a max of 4000 chars can be set for a variable via the controlM interface.

So, the workaround I can think of is to have a wrapper script (which will now be hooked to controlM instead) which will invoke Whatever.ps1 after reading config file. Something like:

sample.ini:

[General]
param1=value1
param2='1111111,2222222'

But I am not sure if writing a wrapper script, consume the log output from exising Whatever.ps1 etc. is the best idea. So, just wondering if there is a way so that values from the config file can be directly fed to Whatever.ps1. Something like

powershell -NoLogo -NonInteractive -Command "D:\path\to\Whatever.ps1 -param1 sample.ini[param2] -param2 sample.ini[param2]"
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Soumya
  • 885
  • 3
  • 14
  • 29
  • Add an INI parser to your script and pass it the filename and an array with the key names as parameters. – Ansgar Wiechers Oct 07 '19 at 14:53
  • @AnsgarWiechers Whatever.ps1 does a very specific task. I would rather not like to add a parser in it, to bypass the limitation imposed by controlM, as it is completely unrelated to the task it performs. That is where I started to think of a wrapper script which will instead parse & invoke Whatever.ps1. Thanks for your prompt response. – Soumya Oct 07 '19 at 15:10
  • Whether you build the parser into that script or into another script inovking that script is irrelevant. The procedure is essentially the same. – Ansgar Wiechers Oct 07 '19 at 15:17

0 Answers0