microsoft / microsoft/terminal
RunAs Administrator returning "SYSTEM" as $env:USERNAME in PowerShell
- Dominant language
- C++
- Stars
- 105k
- Forks
- 9.6k
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 29
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:
```powershell
$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.
Contributor guide
Assessment
This issue has not been assessed yet.