AutoSys Workload Automation

  • 1.  Set Global Variable with PowerShell?

    Posted Dec 19, 2018 04:44 PM

    All,

    Is it possible to assign a global variable using powershell instead of the normal windows command line interpreter?

     

    Example for a global variable to be set for command line for the date you need to use the following:

    sendevent -E SET_GLOBAL -G "Today=%date:~4,2%-%date:~7,2%-%date:~10,4%

     

    I'm wondering if it is possible to do a similar item with powershell to come up with a custom format date without all the command line items

     

    E.g. sendevent -E SET_GLOBAL -G "Today" = powershell.exe Get-Date -f 'yyyyMMdd'

     

    I realize the above syntax is incorrect, but demonstrating an example.  Basically using PowerShell's functionality to set global variables for dates and even other items.

     

    Thanks in advance.

    Chris Kent

    Dart Container Corporation



  • 2.  Re: Set Global Variable with PowerShell?

    Posted Dec 20, 2018 07:14 AM

    Of course. Also in Perl, which is more portable.

     

     

     

    Steve C.

     

     

    Nothing in this message is intended to constitute an electronic signature unless a specific statement to the contrary is included in this message.

     

    Confidentiality Note: This message is intended only for the person or entity to which it is addressed. It may contain confidential and/or privileged material. Any review, transmission, dissemination or other use, or taking of any action in reliance upon this message by persons or entities other than the intended recipient is prohibited and may be unlawful. If you received this message in error, please contact the sender and delete it from your computer.



  • 3.  Re: Set Global Variable with PowerShell?
    Best Answer

    Posted Dec 20, 2018 09:35 AM

    You will just need to set the environment, for example:

    PS > $env:Path = $env:Path + ";C:\PROGRA~2\CA\WORKLO~1\AUTOSYS\bin"
    PS > $env:AUTOSYS = "C:\PROGRA~2\CA\WORKLO~1\autosys"
    PS > $env:AUTOSERV = "ACE"

     

    Once the env is set you can run client commands.

    Note: depending on system settings you may need to use the full path instead of 8.3 shortnames.

     

    Regards,

    Mark Hanson



  • 4.  Re: Set Global Variable with PowerShell?

    Posted Dec 20, 2018 10:02 AM

    Thanks Mark, greatly appreciated.