Powershell Output Error

Hi,

When I am trying to run power shell script from UiPath (Community Edition) using the activity “Run Power Shell Script” and displaying the output in the message box it displays the output as "System.Collection.Generic.List’1[System.String] instead of the number which I am fetching.

Note : When I run the powershell script individually it displays the output correctly but from UiPath I am not able to do so.Poweshelll2

Please Help.

Kind Regards,
Zoya

HI @Zoya,

If you’re trying to run a script make sure to do this:

image

In addition, if the command you’re trying to perform can’t be performed it will generate an error. Let’s say you want to close the notepad using a cmd command using the invoke power shell activity and there’s no notepads open it will generate an error. To evade that kind of stuff change the ContinueOnError to true.
image

I am using " Run Power shell Script "

Are you using the same version as me?
image
You should have in Misc all these parameters
image

Make sure to update your Uipath packages to the latest version. Go to Mange Packages and update your Uipath.System.Activities.

image

The power shell script which I am executing is fetching the ( ex - “Number : 678765376” ) and displaying the output as 678765376
Is there any other way in UiPath in which I can get the number directly from text file.

I have tried Invoke Powershell too … but getting the same error as mentioned earlier “System.Collection.Generic.List’1[System.String]” .

All the packages are updated

Use “Read Text File” then use regex or split string to get the desire number.

image

How to use split in UiPath.

Would be glad if you could help regarding this .
How do I split Number and start date and get the output as 6754807090 and 11/01/2019 respectively in UiPath directly

Number: 6754807090
Start Date: 11/01/2019

Split1

I tried Split functionalitybut the output isn’t coming the way I expected .

Ok. will that be always the order? Number first and then start date or it varies?

It will be in same format.

Example :

Number: 6754807090
Start Date: 11/01/2019

splitstring.zip (11.7 KB)

Let’s try regex, please let me know if it works for you.

Thanks alot !!! :slight_smile:

It worked … Will let you know incase I face any issues

1 Like

No problem, that might only work for that example but you can find almost anything in regex. You can search a little bit about it. You can find out more here in this forum or in google. Not only uipath uses regex.

Powershell%20Output1

I am using “Run Power shell Script” and have given the path of the script directly.
But still facing issues .
It’s a basic script which I am executing to check if the output gets generated or not but in vain.
why am I getting the output as "System.Collections.Generic.List’1[System.object]

change object to string and try again

PoweshellN1

Hi,

Please check the screenshot.

I tried changing from Object to string.

Still the output is 'System.Collections.Generic.List’1[System.string]