Skip to content

RunAs Administrator returning "SYSTEM" as $env:USERNAME in PowerShell #16200

Open
@mpearon

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).
image

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.

Metadata

Assignees

Labels

Area-TerminalConnectionIssues pertaining to the terminal<->backend connection interfaceIssue-BugIt either shouldn't be doing this or needs an investigation.Priority-2A description (P2)Product-TerminalThe new Windows Terminal.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions