RunAs Administrator returning "SYSTEM" as $env:USERNAME in PowerShell #16200
Open
Description
Windows Terminal version
1.19.2682.0
Windows build number
10.0.22621.0
Other Software
Windows PowerShell 5.1.22621.2428
PowerShell 7.3.8
Steps to reproduce
Launch Terminal as Administrator (Win+X, A)
Issue the following:
$env:USERNAME
Expected Behavior
The username of the currently logged in user should be returned
Actual Behavior
SYSTEM
is returned
The screenshot included shows PWSH 7.3.8 running outside Terminal (top left) and inside Terminal (top right) and Windows PowerShell 5.1 running outside Terminal (bottom left) and inside Terminal (bottom right).
The output of $env:USERNAME
(which is the expected output) has been redacted in the screenshots and the prompt customized to prevent data leak - but this occurs with no customizations and with a fresh installation of Terminal from the Windows Store.