AppWorx, Dollar Universe and Sysload Community

 View Only
  • 1.  Launch Uproc from powershell script

    Posted Jan 27, 2016 09:40 AM
    Version 6.4.22 windows 2012 Situation is a Uproc runs and calls a powershell script. A powershell script is used as the language is easier for this situation than the default DOS. The PS script looks in a directory and finds a number of files which could range from 1 to say 25.  The idea is for every file found the file would be moved to an archive directory the a seperate Session launched to process the file. In a Uproc the launch can be done using a uxadd FLA command. What is required is to have the same function done in the powershell script. Rememeber that the script is launched from a Uproc and the uproc will hold onto the script for the duration of its run so it should be able to do this. As a test the environemnt was loaded to a powershell session by running uxsetenv.bat however it was not possible to access the $U variables in powershell such as UNI_DIR_EXE (or UXEXE in v 5). Is there a step mission like exporting the variables so they can be used in a powershell session after loading the environment? Is this possible or will the script need to be rewritten so it can be run directly in a CL type Uproc or will some sort of set up be required to allow Powershell to launch Uprocs and Sessions even thought this woul dbe happening on the local node.  Seems I may have missed somethign obvious.


  • 2.  Launch Uproc from powershell script

    Posted Jan 27, 2016 09:41 AM
    The powershell script would be using a for-each loop to process each file.


  • 3.  Launch Uproc from powershell script

    Posted Jan 27, 2016 09:51 AM
    In Powershell would this the equivilent of loading a module? Is there an Automic $U module?


  • 4.  Launch Uproc from powershell script

    Posted Jan 28, 2016 03:45 AM
    In a MSDOS script it is possible to load the environment by doing a call to uxsetenv then the variables such as %UXEXE% can be referenced in the subsequent script.

    In powershell the equivilent would be invoke-expression -command uxsetenv.bat which returned that the environment had been loaded however it was not possible to access the variables in the same way as MSDOS. If this was possible then PS could eb used to launch the Uprocs/Sessions with a uxadd FLA command. Can this be done?


  • 5.  Launch Uproc from powershell script

    Posted Jan 28, 2016 10:02 AM
    OK got to the bottom of this.

    $U does pass all of the variables to powershell, its how powershell can access them. Cannot just use $UXEXE in PS as that is a script scope variable, instead the environmental variables need to be accessed.

    Use the command '(env\UXEXE).value' and low and behold the value is available. From here its easy enough to access the power of $U within powershell by calling commands using call ./c

    Uprocs and sessions can now be launched from powershell with a standard $U command line, get the quoting right as not a lot reqquired in PS.


  • 6.  Launch Uproc from powershell script

    Posted Jul 31, 2017 11:22 AM
    Hi Angus Reid.
    Hope you are well. Many thanks for you post here this really looks like something we will use as we have reached the limitations with DOS for what we need to do.
    We are not super great at PS so are having trouble when you mention '(env\UXEXE).value' 
    What do you mean bu this?
    Is env= EXP or APP and value = uxlst node (or something like that)?

    Thanks in advance.
    Ryan


  • 7.  Launch Uproc from powershell script

    Posted Jan 19, 2018 04:43 AM

    Cd to the executable directory then load the env using dot slash notation .\uxsetenv.bat

    Within a PS script you can register the environmental locations by setting variables such as

    $UXEXE = (dir env:\uxexe -ea 0).value #to get the executables folder


    Then cd to the executables folder and carry out commands using cmd /c

    cmd /c "uxadd something... use PX type variables $ such as user=$PsUser..."

    May need to catch the outcome of the cmd/c to make sure command works as expected.



  • 8.  Launch Uproc from powershell script

    Posted Jan 23, 2018 11:46 AM
    I think that it would be wise to ask an evolution request concerning your issue.

    Please go on ideas.automic.com

    Thanks Ryan_Kelly_3352 for your help.