PowerToys
PowerToys copied to clipboard
Peek cannot peek on mapped network drive if PowerToys is running as admin
Microsoft PowerToys version
0.70.0
Installation method
PowerToys auto-update
Running as admin
Yes
Area(s) with issue?
Peek
Steps to reproduce
- Map a network drive to a share in an unelevated process.
- Launch an elevated app (such as cmd or pwsh) and check that the drive is indeed not available when elevated.
- Open File Explorer unelevated.
- Navigate to the network drive letter.
- Peek any file or folder on it.
✔️ Expected Behavior
Peek works as expected.
❌ Actual Behavior
Because the drive is only mapped for unelevated processes, Peek fails to read the file and you get an error message.0
Not sure what a good fix for this is. Given there is also an issue with Mouse Without Borders regarding elevation, a long term solution may be to split PowerToys into two processes, one of which runs code that benefits from elevation, the other which runs the bulk of the code.
Another user reported they could not Peek files inside ZIP files (this is because Peek uses normal file system APIs to read files, so it can't Peek shell objects that don't have real files backing them). So it may make sense to use the shell API to read the files, I am not sure if that would help for this case or not.
Other Software
No response
@SamChaps Looks like we have to start the module always non-elevated like we did for PT Run.
I wonder if we should restrict Peek from running as admin. Is running File Explorer Windows as admin a thing?
Also, according to ChatGPT, right now we're hitting all of these with Peek:
There might be an interest in keeping Peek available for admin or system windows.
Is running File Explorer Windows as admin a thing?
@jaimecbernardo This is impossible. The Windows Explorer runs always in the user's context.
I think a solution here might be to have a Setting that makes it so that Peek always runs un-elevated. And set that to true by default. That way people can disable that if they run into trouble.
Can replicate this by creating a local network share like this:
net use t: \\localhost\c$\tempshare
When running as admin, Peek won't be able to view these files.
Similar problem occurs if PowerToys is running under a different user after an update (my admin is separate) so accessing files in the personal folder fails as well (though I would have assumed that admins can read everything as they are, well, admins with elevated rights)
@binarynoise , I think the fix I'm proposing should fix you case as well.
Fixed in 0.71 release of PowerToys. aka.ms/installpowertoys