Invoke Powershell Activity with Parameters and PowerShellVariables

Does the Invoke Powershell activity actually work? It seems absurdly difficult to use.

  1. Here are some simple commands that work in a Powershell window:

get-process winword
get-process winword,notepad
get-process -Name winword
get-process -Name winword,notepad

  1. And now, UIPath:

image

This works:

But this does not:

Can someone please explain to me why Invoke Powershell and its Parameters and PowerShellVariables make it so maddenlingly difficult to reproduce a simple Powershell command?

I thank you in advance,

Tom

Hi @tsverthoff ,

Could you please refer the below thread. it seems policy issue at your end. thanks.

Regards,
Kirankumar.

Hi @tsverthoff

try this out

please save the powershell script into text document,
read the txt document with read text document activity & pass the output variable to the invoke power shell activity

thanks
@Robinnavinraj_S

Blockquote

Hi Kir. Thank you for responding. I’ve read the thread that you posted, however, I don’t think it applies in my case because this will work:

image

Hi @Rob. Thank you for your idea. I’ve tried writing the powershell commands to a text file and reading them into the automation as you suggest. It does indeed work. I generally prefer not to have an automation project write to local files because the automation will eventually be deployed to a user’s machine. Then you have to worry about things like access permissions, file path validation, etc.

Hi @tsverthoff

can you please share the powershell script , I will try to do in powershell script alone ,The task you want do in Uipath

Regards,

1 Like

@ppr That article has some good information, but it doesn’t mention anything about the use of PowerShellVariables.

And also: