Invoke Powershell - In and Out Arguments - how can I extract data from the PS into UIPath?

Hi guys,

I played around with the Powershell and can not figure out how to operate it correctly.
I use the invoke powershell activity.

The script looks like this:

Param(
	[string]$processName
)

get-process $processName

$test = "hello everything is fine"

I have it setup like this:

So first I get the script from textfile and then running it using this parameter. This seems to work because no error appears. BUT

So what I want to do know in Powershell is the following:

  • Import the $processName argument ==> this seems to be already working
  • Output the last variable from my script $test = "hello everything is fine" in a variable into UIPath Studio. For example after the PS script finishes I want to log this message.

What do I have to do to get logging from the PS Script? This is obviously just an example but I want to access the logs in the PS Script inside UIPath.

My idea was to add all logs that appear in the PS Script into an array and then return it to UIPath and then I log it. But I don’t know how to get out data from the PSScript to UIPath.
I played around with the “output” argument of the activity but it just doesn’t work or confuse me very much. I read that article: PowerShell and UiPath - "Invoke PowerShell" Tutorial | UiPath but that doesn’t cover my question unfortunately.

Any ideas? Thank you very much.

Nevermind just after I created it I figured it out. Here is the solution:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.