0

Whenever I run a powershell script, I get the error:

Set-ExecutionPolicy : Windows PowerShell updated your execution policy successfully, but the setting 
is overridden by
a policy defined at a more specific scope.  Due to the override, your shell will retain its current effective
execution policy of Unrestricted. Type "Get-ExecutionPolicy -List" to view your execution policy settings. For more
information please see "Get-Help Set-ExecutionPolicy".

This doesn't happen when I run scripts in Powershell ISE or run commands on the command-line. Is there anyway to stop this from happening?

HackerMan
  • 200
  • 1
  • 13

1 Answers1

1

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
Alex_P
  • 2,580
  • 3
  • 22
  • 37