Hi @philwaller
Just to add something. If you are using Studio Windows projects, then the Invoke PowerShell will use the PowerShell 7.1 available in the PowerShell SDK that comes with the System package and not your machine installation of PS.
This means that your normal execution policies will not affect the actual process.
You can easily fix that by adapting the policy at the start of your script, i.e. like so:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process