AppWorx, Dollar Universe and Sysload Community

 View Only
  • 1.  Passing parameters to PS Uproc from U_ANTE_UPROC

    Posted Jul 16, 2019 04:06 AM
    ​Dollar universe 6.9, Windows server 2012 R2, Powershell v 5

    Plan is to use Powershell modules with $U to leverage the power of Powershell.  MU variables will be used to set up environments so the same Uproc can be used everywhere but the environmental variables are dynamically worked out at runtime.  To make things easy 3 standard variables will be worked out and expanded within the U_ANTE_UPROC, so that any future changes will only require a change to the U_ANTE_UPROC and not hundreds of Uprocs.

    So far so good, variable expansion working fine and all the variables are wrapped into a single variable to pass to the PS type uproc as a PS type syntax.

    To further simplify things the PS Uproc calls a master wrapper script which in turn has different modules to carry out whatever function is required.

    So its U_ANTE_UPROC -> PS Uproc  -> PS master script containing modules, the Uproc command being like below
    i.e. PS_MASTER <parameter string from U_ANTE_UPROC>

    The issue is that although the variable expansion works fine in the U_ANTE_UPROC and creates the correct commands when the Uproc ruuns the parameter is being interpreted as a system string so the PS command does not work.  If the same prameters are written in the PS uproc the behaviour is as required.

     Is there a way to get the parameters from the U_ANTE_UPROC (written in dos) to work correctly in the PS Uproc. This could be as a hastable or some kind of splatting.  It is a PS issue but this is hard to resolve as need to know what $U is doing when passing variable strings to PS Uprocs.

    Wanting to keep the simplicity so that any changes require changing the parameters being passed from the U_ANTE_UPROC or additional modules in the PS side. The Uproc remaining constant and simple.


  • 2.  RE: Passing parameters to PS Uproc from U_ANTE_UPROC
    Best Answer

    Posted Jul 17, 2019 10:14 AM
    Have a resolution for this, the issue is down to variable expansion when creating the hashtable. Takes another line in the Uproc to work this out but the outcome now means that the U_ANTE_UPROC can pass parameters to the downstream PS master script as a single parameter in the Uproc. ​