Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Powershell as Admin - Ignoring system path variable #14686

Closed
SteseDav opened this issue Jan 16, 2023 · 9 comments
Closed

Powershell as Admin - Ignoring system path variable #14686

SteseDav opened this issue Jan 16, 2023 · 9 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity.

Comments

@SteseDav
Copy link

Windows Terminal version

1.15.3466.0

Windows build number

Version 10.0.22000.856

Other Software

No response

Steps to reproduce

Windows Powershell (elevated to admin) reads the PATH system variable and uses the items within correctly. (I have a custom scripts folder which I call all the time, so it's easier to just type the command)

With a Powershell tab in Terminal, running as admin, doesn't seem to do this by default,

Expected Behavior

I should be able to reference my powershell scripts directly without using the full path.

Actual Behavior

Powershell in Terminal cannot find the scripts, and gives a standard "unable to find" error.

@SteseDav SteseDav added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jan 16, 2023
@zadjii-msft
Copy link
Member

What's the environment in each type of session (elevated vs unelevated)? I just wanna see if there's anything immediately obvious about the difference that jumps out.

How are you running the Terminal as admin? Via some mechanism in the OS (like right-clicking on the taskbar, or via the Start Menu), or are you using the Terminal's built-in "run this profile elevated" functionality/?

(note to self: this isn't going to be a defterm thing, cause obviously, defterm doesn't work for an elevated powershell.exe)

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jan 16, 2023
@SteseDav
Copy link
Author

HI,

Sorry, i'm not following specifically what you mean by environment here. I'm on a Windows 11 machine, with local admin rights to the machine. (sorry if I'm being dense).

I'm using Terminals inbuilt 'Run this profile as Administrator' option.

Regards,

Steve D.

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Jan 16, 2023
@zadjii-msft
Copy link
Member

Oh sorry, I meant PATH when I said "environment". Whoops, that's on me 🤦

@zadjii-msft zadjii-msft added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Jan 16, 2023
@SteseDav
Copy link
Author

Ahh! I see... I have simply added a folder to the path variable. In the path below, it's highlighted in bold text.

PATH=C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;%ONEDRIVE%\Documents\Code_Script;C:\Users\SDavison\AppData\Local\Microsoft\WindowsApps;;C:\Users\SDavison\AppData\Local\Programs\Microsoft VS Code\bin

@zadjii-msft
Copy link
Member

Sorry, to extra clarify - is that the PATH in an unelevated window, or the PATH in an elevated (admin) window?

What's the PATH look like for the other type of window?

@ghost ghost added the No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. label Jan 23, 2023
@ghost
Copy link

ghost commented Jan 23, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@SteseDav
Copy link
Author

That's the system environment PATH, its from neither window.

@ghost ghost added Needs-Attention The core contributors need to come back around and look at this ASAP. and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. labels Jan 24, 2023
@zadjii-msft
Copy link
Member

Gotcha - so, what does PATH look like in each of an elevated/unelevated window/? Maybe there's some diff in one of those PATHs (when compared to what it should be) that might give us a clue as to where the issue is originating.

This might get better in 1.17 after #14637, so I might also have you try out that build (when we release it later today)

@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity. and removed Needs-Attention The core contributors need to come back around and look at this ASAP. labels Jan 24, 2023
@ghost
Copy link

ghost commented Jan 28, 2023

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

@ghost ghost closed this as completed Jan 31, 2023
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting No-Recent-Activity This issue/PR is going stale and may be auto-closed without further activity.
Projects
None yet
Development

No branches or pull requests

2 participants