views:

218

answers:

3

Hello,

I have an application that executes an upgrader application automatically whien it starts. However, when the first app laucnches and sees that an upgrade is needed it launches the upgrader and fails becuase of security in Vista. If i launch the upgrader manually as an Administrator then it functions correctly.

1) How can i do this automatically from the first app?

2) If i set the properties to launch as admin then I get the security dialog... how do I launch it without any Vista security/permission dialogs?

Thanks for the help!!

A: 

A straight forward approach would be to disable Vista’s UAC. Information on how to do this can be found at http://www.vista4beginners.com/How-to-disable-UAC. An obvious flaw of this method is that it will affect all applications, which may pose a security concern. If security is a concern you may wish to pursue another method.

l3a0
It's not only not straight forward or a security concern, it's a user's solution to the problem. It does not solve the original problem from the application's point of view.
OregonGhost
+1  A: 

If you're trying to do this on your own system, disabling UAC, as suggested by I3a0 will work.

If this is for software your deploying on other systems, I'm afraid there is no direct way to do this. Avoiding the security dialog would be defeating the UAC system entirely - if there was an easy way to get around it, it would be useless. The dialog exists because you are doing something that requires elevated permissions.

There are a couple of options here:

1) Rewrite your upgrader as a service, with some form of IPC from your user-space application that notifies it to upgrade. This would allow it to be installed on the system as an administrator, and running in the background, so it already had admin privs when you requested an upgrade.

2) Figure out what specifically requires elevated privileges in your upgrade application, and rework those sections so it can be run as a normal user.

Reed Copsey
+4  A: 

So you want to launch an installation that requires admin rights without admin rights? Because, you know, with UAC enabled, launching an app with admin rights requires the dialog by definition. That's the whole point of it.

Don't even try that. Look at Firefox, a decent application with automatic update. You'll have to confirm the consent dialog for every update, and that's fine. Because if the user does not want that, he can disable UAC. But that is his problem, not yours. You are not supposed to disable UAC from/for your program. It's like a guest requiring unlocking of all doors to enter when you could just ring the bell at the front door.

Embed a manifest into the updater that specifies requireAdministrator. This will show the consent dialog if the user has UAC enabled, and will work flawlessly if the user has UAC disabled.

Regarding Reed Copsey's solution 1: If your updater is a service, people might not like that. Unless you're a well-trusted, let's say, Anti-Virus company, this could damage your reputation seriously.

OregonGhost
This is a commercial application so disabling UAC is up to the user, not us, so I guess that is not a desirable solution. As for a service I agree.
Tony

related questions