This concept really helps when you want to get multiple, individual items outside of a Powershell script and into multiple Automate scripting variables without messing about running a script multiple times to get different outputs.
Step 1
In the scripting engine add a script step that does an Execute Script > Powershell. Add the following script in Script to Execute (click the ellipsis on the right hand side to get a full window):
1 2 3 4 5 6 |
$obj = @{} $obj.Status = "Something Here" $obj.Gavsto = "Hi" $obj.MessageHere = "Success" $Final = [string]::Join("|",($obj.GetEnumerator() | %{$_.Name + "=" + $_.Value})) Write-Output $Final |
Step 2
Generate a second step, Variable Set > Split NameValue Parameter. In Parameter put @[email protected] or whatever you set in step 1, and leave variable name blank
Step 3
That’s it! All variables that were set in the Powershell in step one will now be available in the standard @[email protected] format within the script once step 2 has executed:
Nice!
Nice job ll using it in many script now !