Unless I've missed something, I cannot reproduce your issue, here's example, I've just perfromed on a Test machine for you.
First I opened an elevated powershell.exe window, i.e. 'as administrator`:
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:\WINDOWS\system32> $Env:Path C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\Tester\AppData\Local\Microsoft\WindowsApps PS C:\WINDOWS\system32> [Environment]::SetEnvironmentVariable('Path', ($Env:Path + ';C:\Program Files\Foo'), 'MACHINE') PS C:\WINDOWS\system32> $Env:Path C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\Tester\AppData\Local\Microsoft\WindowsApps PS C:\WINDOWS\system32> [Environment]::GetEnvironmentVariable('Path', 'MACHINE') C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\Tester\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Foo PS C:\WINDOWS\system32>
Then I opened a new non elevated powershell.exe window:
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:\Users\Tester> $Env:Path C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\Tester\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Foo;C:\Users\Tester\AppData\Local\Microsoft\WindowsApps; PS C:\Users\Tester> [Environment]::GetEnvironmentVariable('Path', 'MACHINE') C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\Tester\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Foo PS C:\Users\Tester>
As you can see C:\Program Files\Foo was shown in both example outputs.
Then I opened another new elevated powershell.exe window:
Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:\WINDOWS\system32> $Env:Path C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\Tester\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Foo; PS C:\WINDOWS\system32> [Environment]::GetEnvironmentVariable('Path', 'MACHINE') C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Users\Tester\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Foo PS C:\WINDOWS\system32>
As you can see C:\Program Files\Foo was shown in both example outputs.
[Environment]::SetEnvironmentVariable('PATH', $UpdatedPathList, 'MACHINE')Path, you'd use this[Environment]::SetEnvironmentVariable("Path", $Env:Path + ";C:\SomeLocation", "Machine"), so unfortunately as you've not shown or provided the code which specifically defines the value of the$UpdatedPathListvariable, we don't know if it contains the required information. Also you need to understand that whilst you may have added it to the System, (Machine), environment, your PS Session inherits only what was defined when it started, new additions are not propagated into an existing session.Pathvalues, it will show all of those available underMachine, andUser, when the PS session was opened, and any created in that session, i.e asProcess. If you want to create a persistent variable, inMachineorUser, and wish also to use it in the same session, you'd need also to define it as aProcessvariable e.g.$Env:Path += ";C:\SomeLocation", or[Environment]::SetEnvironmentVariable("Path", $Env:Path + ";C:\SomeLocation", "Process").The issue is when I start a new, fresh Powershell session2) Take a look at the picture, the path is there. Therefore, it was provided to theSetEnvironmentVariablefunction correctly. I think I need to provide more info because apparently, the question is not clear. Get to the STEPS TO REPRODUCE section in order to reproduce the behavior on your machine