Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force NOT WORKING
<p>I'm trying to setup Node.js and Python on my work laptop.</p>

<p>I've installed Node and Python successfully.</p>

<p>When I'm trying to update my npm using this command in Windows PowerShell:</p>

<pre><code>Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force 
npm install -g npm-windows-upgrade 
npm-windows-upgrade 
</code></pre>

<p>While setting execution policy to unrestricted it throws the error in the image below and says "Cannot run scripts on this system".</p>

<p><a href="https://i.stack.imgur.com/5xzTv.png" rel="nofollow"><img src="https://i.stack.imgur.com/5xzTv.png" alt="Please check image"></a></p>

<p>I did run <code>Get-ExecutionPolicy -List</code>. It shows a table:</p>

<pre>        Scope  ExecutionPolicy
        -----  ---------------
MachinePolicy     RemoteSigned
   UserPolicy        Undefined
      Process        Undefined
  CurrentUser     Unrestricted
 LocalMachine     Unrestricted</pre>

<p>How do I make it run scripts?</p>

<p>My OS: Windows 7 Enterprise 64 bit.</p>

<p>The error message show the root of error:</p>

<pre><code> Window powershell updated your execution policy suceffully, 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 remoteassigned. 
</code></pre>

<p>So, there is a group policy setting  for the current user assigned to remoteassigned and can't be changed by the command.</p>

<p>Modify the setting in the group policy as in the given steps:</p>

<pre><code> run: gpedit.msc
</code></pre>

<p>In the left tree, select:</p>

<p>user configuration -> administrative templates->
windows components -> windows powershell</p>

<p>turn on script execution -> enabled
As in the figure:
<a href="https://i.stack.imgur.com/YVGLB.png" rel="nofollow"><img src="https://i.stack.imgur.com/YVGLB.png" alt="enter image description here"></a>
<a href="https://i.stack.imgur.com/6EUqG.png" rel="nofollow"><img src="https://i.stack.imgur.com/6EUqG.png" alt="enter image description here"></a>
If your machine is a member of domain and you log as a domain user, there may be a restriction for modification. </p>

<p>In that case contact the Domain administrator to modify your group policy.</p>

python node.js powershell executionpolicy