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

Apps run with Keyboard Manager do not respect the selected elevation mode when running PowerToys in administrator #32206

Open
jackharro opened this issue Apr 3, 2024 · 22 comments
Labels
Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Product-Keyboard Shortcut Manager Issues regarding Keyboard Shortcut Manager

Comments

@jackharro
Copy link

jackharro commented Apr 3, 2024

Microsoft PowerToys version

0.79.0, 0.80.0

Installation method

PowerToys auto-update

Running as admin

Yes

Area(s) with issue?

Keyboard Manager

Steps to reproduce

I'll put details in brackets

  1. Start PowerToys in Administrator (Always run as adminstrator)
  2. Remap a chord to start an app (Win + T to start Windows Terminal)
  • You can follow KBM → Remap a shortcut → Win + T → Action: Run Program → Select Program → type wt in the directory field, close the terminal window, and copy and paste the directory field contents to the file name field)
  1. Set the elevation to normal
  2. Save the confuration, hit Win + T, and find that the command prompt is in administrator mode

✔️ Expected Behavior

Windows Terminal, the app opened by a remapped shortcut, is opened with normal privileges

❌ Actual Behavior

Windows Terminal, the app opened by a remapped shortcut, is opened with adminstrator privileges

Other Software

Windows Terminal 1.19.10821.0
Windows 10 22H2 build 19045.4170
UAC Settings is set to Never Notify (i.e. skip administrator password entry)

@jackharro jackharro added Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Apr 3, 2024
Copy link

github-actions bot commented Apr 3, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Open similar issues:

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@htcfreek
Copy link
Collaborator

htcfreek commented Apr 3, 2024

@jacko-png
Can you please upload some screenshots and a /bugreport. This would be very helpful.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams labels Apr 3, 2024
@htcfreek htcfreek added Product-Keyboard Shortcut Manager Issues regarding Keyboard Shortcut Manager Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Apr 3, 2024
@jackharro
Copy link
Author

Apps.run.with.Keyboard.Manager.do.not.respect.the.selected.elevation.mode.when.running.PowerToys.in.administrator.mp4

@Curstantine
Copy link

I can reproduce this issue too. Pretty annoying and unsafe. I didn't realize but I've been using admin mode to run different shell scripts for weeks now :(

image

Recording.2024-04-04.085911.mp4

@htcfreek
Copy link
Collaborator

htcfreek commented Apr 4, 2024

@jacko-png
The run as administrator problem is logical for me even if isn't what users are expecting. It should be reworked.

But you wrote something about a wrong working directory. And I don't understand exactly how this problem behaves. Can you post a screenshot for this too please.

@jackharro
Copy link
Author

jackharro commented Apr 5, 2024

<removed to keep the scrolling clean, I had screenshots and a description of the working directory issue which is separate>

@htcfreek
Copy link
Collaborator

htcfreek commented Apr 5, 2024

@jacko-png
Regarding the wt issue I suggest you to check the wt documentation. I imagine that they have a working dir parameter.

@jackharro
Copy link
Author

jackharro commented Apr 5, 2024

Yes, the -d option does this. It's not listed in the --help page, however, so I had to find it on MSDN. For any future commenters, let's return this thread to the elevation issue.

@htcfreek
Copy link
Collaborator

htcfreek commented Apr 5, 2024

Yes, the -d option does this. It's not listed in the --help page, however, so I had to find it on MSDN. For any future commenters, let's return this thread to the elevation issue.

Can you please update the issue description to only describe the elevation issue and add a note that the folder thing is caused by wt. Currently tytle and description are different and this is confusing.

@jackharro
Copy link
Author

jackharro commented Apr 5, 2024

Good idea 👍. I was thinking of ways to clean it up and forgot I could edit.

@Feejus
Copy link

Feejus commented Apr 7, 2024

I have been contemplating a potential enhancement or feature request regarding the search functionality. Currently, when searching for the Command Prompt (Alt+Tab), there is no apparent option to launch it with administrative privileges directly from the search results. I would like to propose the ability to right-click or use an alternative mechanism within the search results to open the Command Prompt in Administrator mode. This would streamline the process of executing commands that require elevated permissions without the need for additional steps.

@jackharro
Copy link
Author

jackharro commented Apr 7, 2024

@Feejus
You could map something like Shift+Win+T to Command Prompt and set it to run in administrator mode. That works just fine, the issue here is that we can't run it in normal mode if PowerToys is run in administrator, which I may or may not need to have to do at some point.

Does your feature request relate to this issue, which is about administrator PowerToys not starting programs in normal mode?

@Feejus
Copy link

Feejus commented Apr 8, 2024

@jacko-png

As to your question, I am afraid no.

When I press "Alt+Space" with PowerToys running, and search for CMD or Terminal, the search results allow me to open these applications. However, when I launch them through this method, they start in a regular user session, without elevated administrative privileges.

If I search in the Start menu I see an option to run CMD as administrator, the alternative is to right-click the search and I get a menu which has "run as admin".

Thanx

@jackharro
Copy link
Author

jackharro commented Apr 8, 2024

As to your question, I am afraid no.

You're in the wrong thread. This is a bug, and that's a feature request. You're talking about Power Toys Run, and we're talking about Keyboard Manager.

By the way, press Ctrl + Shift + Enter next time you try. Should be able to run an administrator command prompt from PowerToys Run.

@jackharro
Copy link
Author

jackharro commented Apr 8, 2024

@jacko-png Can you please upload some screenshots and a /bugreport. This would be very helpful.

@htcfreek
Wait did the bug report not upload? I'll try again.

@jackharro
Copy link
Author

@jackharro
Copy link
Author

jackharro commented Apr 8, 2024

@jacko-png The run as administrator problem is logical for me even if isn't what users are expecting. It should be reworked.

For example, PowerToys Run launches software in normal mode unless you hold Ctrl + Shift, even in administrator mode.

PowerToys.Run.can.start.software.in.normal.mode.mp4

The video shows a normal command prompt and that PowerToys is running as administrator.

@Feejus
Copy link

Feejus commented Apr 8, 2024

As to your question, I am afraid no.

You're in the wrong thread. This is a bug, and that's a feature request. You're talking about Power Toys Run, and we're talking about Keyboard Manager.

By the way, press Ctrl + Shift + Enter next time you try. Should be able to run an administrator command prompt from PowerToys Run.

Thanx for clarification. I very much appreciate it. The reason I did not raise it as FR is that this would work equally as well for me. I.E if the Powertoys is running in Admin and I run CMD, it should run it with admin privileges.

@ThiagoRangel7
Copy link

ThiagoRangel7 commented Apr 10, 2024

In my tests, I noticed that this bug also happens with other UWP apps (like Notepad), but it doesn't happen with desktop apps (like Excel, Photoshop, cmd etc).
It would be great if anyone else can test it and let us know.

You can check if an app is running elevated with the Task Manager (go to the Details tab > Right click the column names > Select columns > Check Elevated).

@htcfreek
Copy link
Collaborator

@jaimecbernardo
Hot fix possible?

@AdreKiseque
Copy link

So this is a bug? I'd figured it might have just been a natural consequence of how Windows works, considering how any process opened out of an elevated terminal will be elevated as well, but that it doesn't occur with native apps does suggest otherwise...

@AdreKiseque
Copy link

Any chance we can get some priority on this? It's a rather troublesome bug...
In the meantime, I have a workaround for anyone suffering it, though it's not perfect. You can set your shortcut to open Explorer with the target executable as an argument, which will launch it through Explorer and thus unelevated. Caveat is you can't add any extra arguments to it (but you can work around this too by creating a shortcut that launches your desired app with its arguments, then opening that with Explorer... ridiculous as that gets).
Just make sure you set KBM to open a new instance "if" Explorer is already running (which it is).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug Something isn't working Needs-Triage For issues raised to be triaged and prioritized by internal Microsoft teams Product-Keyboard Shortcut Manager Issues regarding Keyboard Shortcut Manager
Projects
None yet
Development

No branches or pull requests

6 participants