Marta
(Marta Miąsko - Office Samurai)
1
Hi everybody!
I’m using Invoke PowerShell activity and after reading PS command from .txt file and then passing it as a string, I get the following error:
Invoke Power Shell: Exception calling “.ctor” with “0” argument(s): "The calling thread must be STA, because many UI components require this
Do you know how to solve this problem?
Thanks!
1 Like
Hello @Marta,
you can find here a post about using C#, VB.NET, JScript or PowerShell code as UiPath Studio actvitiy. With the Run PowerShell or Run PowerShell String activities you have the possibility to decide to use single-threaded apartment (STA) or multi-threaded apartment (MTA).

Let us know your results.
Best regards
Stefan