Invoke Power Shell is not working in StudioX

I am getting errors trying to use the “Invoke Power Shell” activity in StudioX. I see a lot of videos, support for Studio, but not for StudioX (They state it’s the same thing, but unfortunately the resolutions do not work in StudioX that I looked all over for.

Anyone have luck running a script using Invoke Power Shell with StudioX? If so, can you explain how you got it to work?

@attila.brizs

Welcome to the community

can you try a basic command and check also what error do you see?

cheers

Hi @attila.brizs

Could you please share what are you passing in activity to run powershell script?

Also share what error you are getting?

Sorry for the post without details.

Here is the error I am getting. I am simply trying to launch a Powershell script that required elevated (administrator) access, which I do have.

Activity Invoke Power Shell (Ui Path. Core. Activities. Invoke Power Shell`1[[ System. Object, System. Private. Core Lib, Version=6.0.0.0, Culture=neutral, Public Key Token=7cec85d7bea7798e]]) failed:

Expression Activity type ‘VisualBasicValue`1’ requires compilation in order to run. Please ensure that the workflow has been compiled.

powershell -file “C:\Users-Redacted links”<[“[k(enter)]”.ToString]>

Hi @attila.brizs

Refer below post on error root cause and resolution.

In short, please remove these double quotes and type them again from your UiPath expression editor. That should resolve the issue.

https://uipath.my.salesforce-sites.com/CaseView/articles/Knowledge/Getting-expression-Activity-type-VisualBasicValue1-requires-compilation-in-order-to-run?lang=en_US

@attila.brizs

First for powershell with elevated access you need UiPath also to be run as admin or with elevated rights I believe

But the error you are getting is because of wrong double quotes mostly " it should be and not this “

Cheerd

Question about running StudioX as admin…

When I run it as admin, it only tries to open it in a browser and it prompts this:

But cannot open the desktop client.

@attila.brizs

Click on the below link it ahould redirect

Cheers

It does not, that is the issue. Nothing happens.

@attila.brizs

can you try opening assitant also in admin mode

cheers

@attila.brizs can you try solution given here ? StackExchange

powershell -Command "Start-Process PowerShell -Verb RunAs"

Will try now, and see if it will work.

No go…

Close the Studio, create backup of your project (copy paste the folder somewhere safe) and clear %temp% folder and delete or move all the folders starting with dot in your project folder (these are safe to delete, mostly you will loose the project related settings)
Then reopen the project and check

Tried using:

powershell -Command “Start-Process PowerShell -Verb RunAs -ArgumentList ‘-File “SCRIPT PATH REDACTED” -NoExit’”

@attila.brizs

This error is related to double quotes in your powershell command.

Please remove those and re-type from UiPath expression editor.

For more details, please refer the post I linked in my post above

I tried that so many times now and still won’t work.

Tried that also, I even went as far as re-installing StudioX knowing it won’t make a difference, but tried.

Got it to work another way.

Used Invoke Powershell activity and in the text editor used the following and works.

cmd /c powershell -file “File path goes here”

1 Like

Hi @attila.brizs

Now that your issue is resolved, kindly mark your last post as solution so this topic can be closed.

Thank you.