I wish did fix the issue. For running remote scripts you either need Set-ExecutionPolicy Unrestricted, run the script with powershell.exe -ExecutionPolicy Bypass, or sign the scripts. Note that bypassing or changing the execution policy will only work if it's not enforced with a local or group policy.
Getting a Set-ExecutionPolicy error everytime I run a powershell script
By : user3308502
Date : March 29 2020, 07:55 AM
like below fixes the issue As is written in the error message you can check with Get-ExecutionPolicy -List all your policies. The more detailed scope level overrides the more general level. In my case, I solved it by setting the execution policy on the process level.
Set-Executionpolicy -ExecutionPolicy RemoteSigned -Scope Process
Whats does this Windows Powershell ExecutionPolicy error message mean?