Windows – Is it possible to elevate the permission of a program in Windows without using “Run as Administrator”

administratornon-adminpermissionsuacwindows

I have an MSI that needs to run with administrator permissions. This installer will do some admin stuff, and eventually put a shortcut on the user's desktop. When I set the installer to "Run as Administrator", the MSI actually runs under the profile of the admin account. The shortcut gets placed under the admin's Desktop and not under the user's Desktop.

Is it possible to run the installer with elevated permissions (not Run as Administrator) which will prompt for admin credentials, but still run the installer under the non-admin user's profile so the shortcuts, new folders, new files, etc. get placed in the non-admin user's location?

Best Answer

You have two options you could visit.

  1. Find out if the MSI supports the ALLUSERS property, which would do just that: place shortcuts into all users' desktop. Probably the safest and fastest way to implement your deployment.
  2. Modify Aaron Margosis' MakeMeAdmin script, which temporarily adds a user to the "Administrators" group, and removes them as soon as the program launches. This requires two password entries, though: one by the Administrator and one by the user you just elevated to a local admin.

Hope that helps.

Related Question