Invoke Power Shell on Windows target framework - Invoke Power Shell: The term 'Get-AipFileStatus' is not recognized as a name of a cmdlet, function, script file, or executable program

I noticed that the ‘Invoke PowerShell’ activity on the Windows target framework still has not been fixed.

I need to run this script in PowerShell, which works perfectly on the Windows-Legacy target framework:

“Get-AipFileStatus -Path C:\Users\User\Downloads\test.xlsx | ConvertTo-Json”

Unfortunately, it does not work when converted or created as a new project on the Windows target framework.

The guys from UiPath always suggest adding an Execution Policy to the script. I can assure you that such modification still does not work:

“Set-ExecutionPolicy Unrestricted -Scope CurrentUser
Get-AipFileStatus -Path C:\Users\User\Downloads\test.xlsx | ConvertTo-Json”

Finally, I succeeded in running this script by targeting PowerShell 64-Bit with this modification of the code:

“$powershell32 = $env:SystemRoot + ‘\SysWOW64\WindowsPowerShell\v1.0\powershell.exe’
& $powershell32 Get-AipFileStatus -Path ‘C:\Users\User\Downloads\test.xlsx’ | ConvertTo-Json”

The problem is that it takes ~40+ seconds on the Windows target framework, in comparison with ~7 seconds on Windows Legacy.

Questions:

  1. Are there any other ways to run this script more efficiently and faster?
  2. Question for the UiPath team: When are you planning to fix the Invoke PowerShell activity?

Hi @Karolis_Urbonas

We are aware of this issue and we will evaluate the options for future versions. It looks like the PowerShell can either be triggered from the SDK that comes with the System package (which is the case for Windows projects), or from the local machine (which is the case for Legacy ones).

Would a solution that enables one to choose which is true in the activity itself be satisfactory to you? We are still exploring the topic, but I’d like to capture as much feedback as possible on the issue in the meantime.

1 Like

Thank you for your reply!

I’m not sure which solution would be the best. I would like to have the same PowerShell functionality as it is on the Windows Legacy framework.

I believe it’s up to you to determine which solution is the best.

I can confirm that we had a look and System 23.12 will bring significant improvements in the matter.

We added the extra setting that will allow you to choose your desired execution mode.

We will also release updated documentation to clarify some points about the proper usage of this activity.

1 Like