IT Process Automation

  • 1.  ITPAM and PowerShell

    Posted May 28, 2013 02:37 PM
    I am new to the CA ITPAM product. I have a lot of powershell processes that I need to convert to run on ITPAM.
    Can some one give me a sample of running powershell in ITPAM? Currently, I am using ITPAM version 3.1 and 4.0
    I need sample of how to pass ITPAM global datasets variables into powershell or how to use Process variables in Powershell.
    Thank you,

    Hung Trinh


  • 2.  RE: ITPAM and PowerShell

    Posted May 29, 2013 07:20 PM
    Hi Hung,

    It makes sense to break this up into two pieces. The first is how to reference dataset variables in PAM:
    [list]
    [*]Process Dataset variable - Process.myVar
    [*]Operator Dataset variable - Process.myOperator.myVar (used when referencing a different operator's dataset) or Process[OpName].myVar (used when referencing an operator's own dataset)
    [*]Named/Global Dataset variable - Datasets["/path/to/dataset/object"].myVar
    [list]

    Using the syntax above, you can reference and pass variables from any of those datasets to the script. Then you need read the variables in the Powershell script, which is done using the following syntax:

    param($var1, $var2, $var3)

    Thanks,
    Tom


  • 3.  RE: ITPAM and PowerShell

    Posted May 30, 2013 05:09 PM
    hey guys,

    I've had issues with this.

    When passing strings, objects appear to be delimited by blank spaces. Powershell recieves a new argument for every complete word in a string with spaces in it.
    My work around has been to manipulate the string in pre-execution code replacing spaces with underscores. Is this expected behavior, or am I just doing it wrong? thanks.


  • 4.  RE: ITPAM and PowerShell

    Posted May 31, 2013 02:17 AM
    Can you verify the values present as part of process or global dataset variables and see if those contains any spaces . It seems that the values are stored with spaces.


  • 5.  RE: ITPAM and PowerShell

    Posted May 31, 2013 02:44 AM
    To pass strings that have blank spaces in their entirety, you should wrap them with double-quote single-quote double-quote, i.e. "'" + Process.Var + "'" in the Parameters section of the Run Script operator properties.

    Cheers,

    Kaj


    jamaalkirkpatrick4453879 wrote:

    hey guys,

    I've had issues with this.

    When passing strings, objects appear to be delimited by blank spaces. Powershell recieves a new argument for every complete word in a string with spaces in it.
    My work around has been to manipulate the string in pre-execution code replacing spaces with underscores. Is this expected behavior, or am I just doing it wrong? thanks.


  • 6.  RE: ITPAM and PowerShell

    Posted May 31, 2013 09:06 AM
    Very much appreciated, works perfectly. Thanks!

    One more question, returning values. Same sort of issue, I want to return a string but the scriptOutput variable gives me an array of characters. I tried the same technique of wrapping the value in quotes before returning it, but no luck.

    Kaj.Wierda wrote:

    To pass strings that have blank spaces in their entirety, you should wrap them with double-quote single-quote double-quote, i.e. "'" + Process.Var + "'" in the Parameters section of the Run Script operator properties.

    Cheers,

    Kaj


    jamaalkirkpatrick4453879 wrote:

    hey guys,

    I've had issues with this.

    When passing strings, objects appear to be delimited by blank spaces. Powershell recieves a new argument for every complete word in a string with spaces in it.
    My work around has been to manipulate the string in pre-execution code replacing spaces with underscores. Is this expected behavior, or am I just doing it wrong? thanks.


  • 7.  Moving thread.

    Posted May 30, 2013 02:51 PM
    Moving this thread to the PAM General Discussion.

    Mary