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

Open
opened 2026-01-31 07:08:00 +00:00 by claunia · 0 comments
Owner

Originally created by @neilfairall on GitHub (Jul 17, 2023).

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"

Originally created by @neilfairall on GitHub (Jul 17, 2023). ### 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"
claunia added the Issue-BugProduct-TerminalArea-UserInterface labels 2026-01-31 07:08:00 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#20248