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.
"Set-ExecutionPolicy" cmdlet is used for changing the user preference for the Windows PowerShell execution policy. details can be found here.
If the current logged-in user is an administrator on the system with proper access but still getting the above issue, following blogpost instruction may be helpful in re-setting group policy.
However, if the issue persists and "Get-ExecutionPolicy -List" command shows something similar as shown below:
MachinePolicy = RemoteSigned UserPolicy = Undefined CurrentUser = Unrestricted LocalMachine = RemoteSigned
Execute the below commands in powershell commandline as an administrator:
Set-ExecutionPolicy "RemoteSigned" -Scope Process -Confirm:$false
Set-ExecutionPolicy "RemoteSigned" -Scope CurrentUser -Confirm:$false
This will set the execution policy for the given scope.
On executing "Get-ExecutionPolicy -List", we should now see the below:
MachinePolicy = RemoteSigned UserPolicy = Undefined Process = RemoteSigned CurrentUser = RemoteSigned LocalMachine = RemoteSigned
Thank you! This has been vexing me for about an hour before I finally Googled it. Came right to this page.
Thanks , it came as a reliever to me , had been struggling for last 30 mins
The workaround is ok, but I don't understand why it is needed in first place.
Microsoft should be capable to consider, that Group Policies are used, and a procedure should not try to update a setting, which is already sufficient in it's current stage to execute the subsequent scripts.
A quick workaround for a one time incident would be, to delete the value ExecutionPolicy from HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\PowerShell and then immediately run, what you wanted to run before the policy is reapplied to the system. (Just tested with DaRT 8.1)
Wow, Much thanks, this has been a thorn in my side for days on end!