Cannot set Powershell ExecutionPolicy for CurrentUser
Solution 1:
Like all the others have said this seems to be a bug in preview build of Windows 10. I got it to work by simply providing the -Force parameter.
Setting for Local Machine:
Set-ExecutionPolicy RemoteSigned -Force
Setting for Current User:
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force
Solution 2:
This seems to be a bug in Windows 10. I had to create the key HKEY_CURRENT_USER\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell
and create a string value in that key called ExecutionPolicy
with the data Unrestricted
before it would work. Even then, I can't seem to change it without modifying the registry.
Solution 3:
I had a more generalized powershell policy issue than the OP had, but a combination of answers found here and elsewhere ended up being needed for my Win10 Anniversary Edition to correctly update its policies:
1) Make sure this registry entry exists and is set to the lowest security level that you want to allow: HKEY_CURRENT_USER\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell
Name:ExecutionPolicy
Type: REG_SZ
Data:Unrestricted
2) Make sure this registry entry exists and is set to the lowest security level you want to allow: HKLM:\Software\Policies\Microsoft\Windows\PowerShell
Name:ExecutionPolicy
Type: REG_SZ
Data: Unrestricted
3) Update your Group Policy by running gpedit.msc
and navigate to Computer Configuration > Administrative Templates > Windows Components > Windows PowerShell
Select Turn on Script Execution
, then Edit policy setting
with Enabled
and in the box below it that says Execution Policy
, set it to Allow All Scripts
After you've done all that, you can use ddcruver's answer by force-updating your policies depending on what you want. If you set your policies to Unrestricted, I would advise setting all the settings that populate from Get-ExecutionPolicy -List
to something more restrictive, like RemoteSigned
, as malicious powershell scripts are one of the leading causes of memory-based Windows malware.