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?

  • As far as I know, 'run with elevated permissions' and 'run as administrator' are just different ways of saying the same thing. One thing that I do know, having worked on an installer, is that executables whose names contain 'setup' or 'install' (or the localized equivalent) will automatically be run with elevated permissions just because of what installers have to do. – RobH Nov 14 '14 at 17:31
  • "Run as Administrator" elevates the process and runs the process as another user. So yes, there is a difference, even as an Administrator user you have to elevate a process at times. – Ramhound Nov 14 '14 at 17:34
  • 1
    Why is a non-admin user trying run an msi which requires elevation? – kreemoweet Nov 14 '14 at 17:39
  • 1
    @billoreid Yes, it just happens that if the user is a member of the Administrators Group the "other user" it is running as is the same username and user profile. It is still considered "another user" and it has subtle side effects. For example mapped drives disappear for the elevated process, this happens because mapped drives are "per user" and because you are running as "a different user (even though it has the same username)" the mappings don't exist. – Scott Chamberlain Nov 14 '14 at 17:52
  • 1
    @billoreid - The user running the process would have to have those elevated privileges in order to elevate the process as that user instead of another user. – Ramhound Nov 14 '14 at 18:17

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.

  • #1 is what I would ideally like to do, but the installation really requires admin privileges since it installs other software and a Windows service. #2 looks like a very good option which would only require minimal involvement by an actual admin. – billoreid Dec 3 '14 at 15:57

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.