UAC: Run files with reduced privileges

Plug-in and third party software discussion.
Post Reply
hutchinsfairy
Posts: 6
Joined: Tue Apr 20, 2010 8:03 am

UAC: Run files with reduced privileges

Post by hutchinsfairy »

Attached is source for an AutoIt program that I have written for myself to use with "Everything".
I haven't been able to attach the compiled binary as it's 319KB but it's probably safer to compile your own anyway!

I wrote the program so that I could run "Everything" with Admin privileges but launch programs from it with normal User level access.
The heavy lifting is actually done by an AutoIt function written by a member of their forums here.

Install:
  • Download source here
    DropMyRights_v1.0.2.5.zip
    AutoIt Source v1.0.2.5
    (11.38 KiB) Downloaded 435 times
  • Compile "DropMyRights.au3" (or PM me for the binary). Autoit Website.
  • Place "DropMyRights.exe" in the same folder as the "Everything" program (or make a note of location).
  • Change settings in "Everything" as below:
Image

Code: Select all

$exec(".\DropMyRights.exe" "%1")
Usage:
  • Launch programs as normal from within "Everything" and they will have normal User level access, even if "Everything" is run as Admin
  • Hold down Shift when launching the program and you will be prompted to toggle always running the selected program as Admin.
Settings:
  • On first run the program will create an .ini file in the same folder as itself. You can change some settings in that file.
  • BYPASS_KEY is the hex value for the key used to toggle running certain files as Admin (default Shift). You can see a list of common values here.
  • NOTIFY_DELAY is the time in seconds you want the "Admin" notification to be displayed (when you launch a program as Admin from "Everything").
  • NOTIFY_ALL Set to 1 if you want to be notified when programs are run with reduced privileges. Default 0.
  • ADMIN_LIST is a list of file names (including extension) which should always be run as admin. I wouldn't edit this by hand but instead hold down shift when first launching the program from "Everything". Set to 0 to disable notifications.
Other notes
  • Programs that are set to still be run as Admin are identified by filename only.
  • I have extracted the icon from the "Everything" executable so that the taskbar notifications appear to come from "Everything", I hope that's OK!
  • I would expect this to work on a non UAC system but I haven't tested.
  • I'm aware that this has largely been superseded by the introduction of an "Everything" service but this is still useful for me running "Everything" portably.
  • This may not work as expected if your UAC is switched on as a group policy rather than through the registry.
  • Software is provided "as is" and no warranty is provided nor liability accepted! Use at your own risk.
Last edited by hutchinsfairy on Mon Dec 16, 2013 10:40 am, edited 1 time in total.
therube
Posts: 4580
Joined: Thu Sep 03, 2009 6:48 pm

Re: UAC: Run files with reduced privileges

Post by therube »

Everything, if you run it with its' service, already runs with non-administrative level privileges.
hutchinsfairy
Posts: 6
Joined: Tue Apr 20, 2010 8:03 am

Re: UAC: Run files with reduced privileges

Post by hutchinsfairy »

therube wrote:Everything, if you run it with its' service, already runs with non-administrative level privileges.
Yes, and that is probably a better solution for most people. I run "Everything" as a portable application and so like not having to run a separate service and stopping it after closing "Everything". I also like being able to selectively run certain programs with Admin rights. I wasn't really expecting my program to have wide appeal but thought it post it in case it was useful.
therube
Posts: 4580
Joined: Thu Sep 03, 2009 6:48 pm

Re: UAC: Run files with reduced privileges

Post by therube »

Ah, OK.
Post Reply