Search notes:

Registry: HKEY_CURRENT_USER\Environment

PowerShell allows to access the values under this key with
PS> echo [environment]::getEnvironmentVariable("PATH", "user" )
PS> [environment]::setEnvironmentVariable("SOME_VAR", "some value", "user") 

Changing the value in the registry

If the value is changed directly in the registry, a SendMessage(HWND_BROADCAST, WM_SETTINGCHANGE, 0, "Environment") should be executed in order for the changes to take effect.
In PowerShell, this is possible with something like the following
( add-type -passThru -name dummy -memberDefinition '
  [DllImport("user32.dll", CharSet=CharSet.Auto)]
   public static extern int SendMessage(
      IntPtr     hWnd,
      UInt32     uMsg,
      UIntPtr    wParam,
      String     lParam    // Note, this parameter is actually an IntPtr. This construct passes `Environment` as a string.
   );
'
)::SendMessage(0xffff, 0x001A, [UIntPtr]::Zero,  "Environment")

See also

Registry: environment variables

Index