microsoft / microsoft/terminal

Launching Terminal Preview as an administrator causes the username environment variable to be "SYSTEM"

Open
#15,720 0 comments 0 reactions 0 assignees View on GitHub
Area-UserInterface Issue-Bug Product-Terminal
Dominant language
C++
Stars
105k
Forks
9.6k
Avg merge
3d 17h
Merged PRs (30d)
29

Description

### Windows Terminal version

1.18.1462.0

### Windows build number

10.0.22621.0

### Other Software

_No response_

### Steps to reproduce

Right-click on WT icon and select "Run as Administrator"
Enter credentials for a different account than the signed in one.
When the pwsh prompt load, do '$env:username'
The result is "SYSTEM" instead of the expected username.

This does not occur when one launches pwsh outside of WT.

### Expected Behavior

Username returned by the 'username' environment variable should be the same as the credentials used to launch the application

### Actual Behavior

The 'username' environment variable returns "SYSTEM"

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue by launching Windows Terminal with “Run as Administrator,” entering different credentials, and checking $env:username in the pwsh prompt. Trace the administrator launch and environment propagation paths; done means the variable matches the credentials used to launch the application, as it does when pwsh is launched outside Windows Terminal.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.