i cant change Execution Policy on windows powershell

Question:

powershell image
hi, i am trying to change the execution policy on powershell to be able to use pycharm since it gives me error otherwise, but when i try to do that, after i type "Y" or "A" and press enter it doesnt do anything at all.
pycharm error

i tried to run powershell as administrator, copied the commands from websites to change the execution policy, it did nothing for me.

PS C:Windowssystem32> Set-ExecutionPolicy -ExecutionPolicy Default -Scope CurrentUser

Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic at
https:/go.microsoft.com/fwlink/?LinkID=135170. Do you want to change the execution policy?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y
Asked By: Tiygar85

||

Answers:

The Default execution policy on desktop editions of Windows – Restricted – is precisely the one that prevents execution of script files.

You need to pick a policy that allows script execution, RemoteSigned being a good compromise (it allows execution of script files except those downloaded from websites via a browser):

# -Force skips the confirmation prompt.
Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force

This uses the Set-ExecutionPolicy cmdlet to persistently configure the execution policy for your user account (takes effect immediately). -Force skips the confirmation prompt.

Note:

  • For machine-wide configuration, use -Scope AllUsers – however, this requires elevation (run as admin)

  • If GPOs (Group Policy Objects) control the execution policy on your machine, you can not use Set-ExecutionPolicy to override it.

  • For more information, see this answer.

Answered By: mklement0
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.