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") 

Adding a directorty to PATH or PSModulePath

The following simple PowerShell script adds the current directory to a user's PSModulePath:
set-strictMode -version latest

$addedDirectory=$pwd

$psModules_ = [environment]::getEnvironmentVariable('PSModulePath', 'user')

if ($psModules_ -eq $null) {
   $psModules = ($addedDirectory)
}
else {
   $psModules = $psModules_ -split ';'
   $psModules = $psModules + $addedDirectory
}

[environment]::setEnvironmentVariable('PSModulePath', ($psModules -join ';') , 'user')

Changing the value in the registry

If the value of an environment variable 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, HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/Windows/...', 1758197384, '216.73.216.150', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/Windows/registry/tree/HKEY_CURRENT_USER/Environment/index(76): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78