I'm trying to solve a problem where I can't run local .ps1 scripts from the right-click menu without the Execution Policy Change warning appearing after every reboot.
Steps to reproduce:
Open elevated Powershell and run:
Set-Executionpolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Set-Executionpolicy -ExecutionPolicy RemoteSigned -Scope Process
Running ExecutionPolicy -List
then returns:
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process RemoteSigned
CurrentUser RemoteSigned
LocalMachine RemoteSigned
But upon closing and reopening the Powershell window and running ExecutionPolicy -List
again, only the LocalMachine
setting sticks:
Scope ExecutionPolicy
----- ---------------
MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine RemoteSigned
Why don't the other ones stick? I've run DISM restorehealth
and sfc /scannow
and didn't get any errors.