You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set a new value for an environment variable (have tested with TEMP/TMP) in PowerShell 5.1 using the SetEnvironmentVariable method. Then, in PowerShell 7, issue a command to get the value of the environment variable, either using the GetEnvironmentVariable method or Get-ItemProperty for the registry value, in this case: Get-ItemProperty Registry::HKCU\Environment.
Expected behavior
PowerShell 7 reporting the correct updated value for the environment variable or the registry entry.
Actual behavior
PowerShell 7 will report the old NOT updated value. This behavior is persistent across reboots. However, if referencing the environment variable using the $env: notation, the correct value is used.
Environment data
Name Value
---- -----
PSVersion 7.1.3
PSEdition Core
GitCommitId 7.1.3
OS Microsoft Windows 10.0.19043
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0