Invoke PowerShell Activity Works On Windows Legacy But It Does Not Work In Windows Compatibility Projects

Resolution when the Invoke PowerShell activity works on Windows Legacy, but it does not work in Windows compatibility projects.

Issue Description: Error is thrown while running a Python script using Invoke Power Shell in UiPath. Same script runs successfully on Windows Legacy projects and from local PowerShell 32 and 64 runs, but it fails when it s run with Windows compatibility project.


Resolution: When running a script via Invoke PowerShell, before the Invoke Python script activity, that will non-persistently modify the execution policy for Microsoft.PowerShell.SDK 7.1, fixes the issue:

$A = Set-ExecutionPolicy Unrestricted -Scope Process

$C = Get-ExecutionPolicy -List

Out-String -InputObject $C -Width 100