Get the output from powershell script (SOLVED)

Hi,

Do you know how to fetch the output from powershell script and convert it to string ?
I was able to find anything that could help me with that issue.
Now when I am trying to run script and get the output and display it or store as a string I receive the error like:
“Check Outlook Failed, Reason: Object reference not set to an instance of an object.”

Any help appreciated.

Thanks,
Kamil

1 Like

Hi Kamil,

This this like the output of your script.
“Check Outlook Failed, Reason: Object reference not set to an instance of an object.”

This implies that some point in your script you are trying to use something (like a property) from an object variable which is null.

Do you mean that you would like to get output with the line number for example?

What happens when you run the script directly from PowerShell, do you still have this error? is it more explicit?

Lastly, if this is not helping you could share the script so that would you are trying to invoke so someone from help could help to resolve the issue.

Cheers

did you figure this out?

Hi,

Yes I used another powershel action actually and modified a little the script.
I should have access to this on Tuesday so please remind me then and I will share my solution.

Thanks
Kamil Misko

1 Like

Hi Kamil,

i am trying to get the output from a invoke powerwhell activity but no success…could you share how i have to run the powershell script and get the output into a string variable? .

thanks!! BR.

Hi,

So, I used “Run power shell script” not “invoke powerwhell”. I works for me.
image

My script is pretty simple:

$ProcessActive = Get-Process outlook -ErrorAction SilentlyContinue
if ($ProcessActive -eq $null) {
return $a = “False”
} else {
return $a = “True”
}

See the screenshot below:

Hope it will help.
Best Regards,
Kamil

6 Likes

Hi folks,

sorry for delay…thanks kmisko11, it works :wink: !!.

BR.

1 Like

Hi,

Perfect. I am glad I could help :wink:

BR

Can you please help guide from which package “Run Power Shell” can be leveraged? By default only “Invoke Power Shell” activity is available. Appreciate your inputs.

Hi,

Please type into Manage Packages search box “Run Power Shell Script”.
It is the one marked to red on the screenshot below:

Regards,
Kamil

2 Likes

Hi @kmisko11 ,
hope to be fine
could you help me about i want to add input variable from uipath into powershell script but i don’t know how ?

Thanks

Hi,

Thanks for the message. Have you made any tries until now?
I will try to find some time to check it and will reply to this post later on :wink:
Once we find the solution we can edit the Title of this thread or set the new one to make it easier to search.

Regards,
Kamil

Hi there,

The package UIPath.Script.Activities does not seems to be available anymore.
Would you know if the activity have been move to another package?

Thanks

Hi @vincent.trupin

The package is not fully supported and was taken off the feed almost a year ago (you could still download it if you had it in your projects but you could no longer find it).

If you want to invoke PowerShell, you should use this one instead:
image