cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
brianthegood
Level 6

Restarting setup.exe if user lacks privileges

Right now when I start an installation I check for Admin rights and gracefully exit if the credentials are lacking.

What I would like to then happen is place an icon and the setup.exe on the desktop so that it is visible to do a "Run As Administrator" or so that someone can log back in with Administrator privileges and relaunch the setup.exe

I'm thinking the only way to do this would be to take the setup.exe and repackage it into another project as a component that will be placed on the desktop if the user doesn't have credentials or do a LaunchApp after install if they do.

Am I over complicating this?
Labels (1)
0 Kudos
(2) Replies
MichaelU
Level 12 Flexeran
Level 12 Flexeran

I would suggest just using LaunchApplication/ShellExecute and a verb of "runas". An icon on the desktop sounds like a permanent installed fixture which feels inappropriate. The runas verb, on both XP and Vista, can result in switching to an administrator context (it's more guaranteed on Vista than on XP, however, so some explanatory message might help on XP).
0 Kudos
Alfetta159
Level 4

I leapfrogged 2008 by jumping from v11 directly to 2009, so pardon me if I'm way off base, but...

First off, in Vista, this is a non-issue:

I have to run an excutable through a custom action, and if the setup.exe (or msiexec.exe) isn't running as admin, then it gives me the old familiar 1722 error.

So I make sure that I set up the setup.exe with a required execution level of Administrator. THat way, if an admin is installing it, it will do it and if not, it will ask for admin credentials.

With XP the right is determined by how the group rights are set up, so to actually answer your question: Yeah, that would over complicate it. Just let XP be XP.
0 Kudos