title: Powershell: Permanently Modify Path, "Requested registry access is not allowed."
body: <p>I need to permanently add a scripts folder to my PowerShell path (not just a particular session). I am running the following code:</p>
  
  <pre><code>[System.Environment]::SetEnvironmentVariable("PATH", $Env:Path + ";C:\scripts", "Machine")
  </code></pre>
  
  <p>The error is as follows:</p>
  
  <p>Exception calling "SetEnvironmentVariable" with "3" argument(s): "Requested registry access is not allowed."</p>
  
  <p>How do I get registry access/fix this?</p>
  
  <p>EDIT:
  Not sure if it helps, but I'm using PowerCLI (VMware PowerShell API) on Windows Server 2012.</p>