yarn.ps1 cannot be loaded because running scripts is disabled on this system code example

Example 1: cannot be loaded because running scripts is disabled on this system

Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

Example 2: running scripts is disabled on this system

=>run powershell as administrator
=>run foll command
get-ExecutionPolicy
=>if restricted; run following command
set-ExecutionPolicy Unrestricted
=>and set to all
=>again check by foll. command
get-ExecutionPolicy
**it will get unrestricted and problem is solved**

Example 3: \ng.ps1 cannot be loaded because running scripts is disabled on this system.

Set-ExecutionPolicy -Scope "CurrentUser" -ExecutionPolicy "RemoteSigned"

Example 4: cannot be loaded because running scripts is disabled on this system

PS C:\> Set-ExecutionPolicy RemoteSigned