Invoke Power Shell: Exception calling "Open" with "0" argument(s):

This script is working on the same machine in Powershell ISE and but is not working while invoking the PS code in Studio

Error :
Invoke Power Shell: Exception calling “Open” with “0” argument(s): “The type initializer for ‘System.Data.SqlClient.TdsParser’ threw an exception.”

Screenshot of function in the Powershell script:

Do you have “is script” ticket in properties?

Also where do you get the variables like $DBServer from? Do you provide them from Invoke Powershell or where are they defined?

yes “is script” is enabled and passing the required input values as parameter in invoke powershell properties and also tried hardcoded the values inside script.

Required values are passing correctly to script

Hi @Sathish_Kumar_S and @iamNairda,

The Invoke PowerShell activity in some of the recent versions is broken.
UiPath Community 2022.12 Release - News / Release Notes - UiPath Community Forum

See here for an alternative to run your scripts using Start-Process. This may need additional workaround such that your PS script output can be consumed by the UiPath Runtime
Just trying to download a file from a website… this should be easy - Help / Activities - UiPath Community Forum

1 Like

I have discovered the same PS script works in Windows-Legacy project

It is not working in only in Windows compatibility project

Can you advice?

Screenshot for your ref