Reputation: 351
I'm sure this has been asked and answered before, but I can not find the answer I am looking for. We have some old VB6 applications and am trying to run these on Windows 7. They run fine with UAC turned 'off', but when running with the UAC at the default 'level' the applications generate (encounter) 'Requested operation requires elevation' error. I realize that I can a) turn UAC off or b) set the program properties to 'Run this program as an administrator'; but...neither of these are desirable. We want the PC to have normal UAC and we do NOT want that 'User Access Control: Do you want to allow the program to etc.' message box to appear every time our program starts. Our application is a turn-key type program, the customer turns on the PC and our application(s) start. When I select 'Run this program as an administrator' for the application that is in the 'Startup' folder, it will NOT even start anymore (as a an auto-start application, I can still run it from explorer (and get the UAC box)).
So..Is there some way to tell Win7 to run this program as Administrator and do not ask for anything ever again.
I have tried a simple manifest (http://msdn.microsoft.com/en-us/library/bb756929.aspx) but that really did not change anything.
I am really looking for something that can be performed from Inno setup, some sort of setting(s) that I can change that will allow our programs to read/write the Registry, start COM objects and do all the normal stuff we used to be able to do.
The issue is not running the installer 'as administrator', but running what we install 'as administrator' (without right-clicking nor 'OK'ing every time).
Upvotes: 2
Views: 8185
Reputation: 49984
What you are wanting to do is kind of counter to how UAC operates, and your requirement is effectively no different to that needed by zillions of other people when UAC became mandatory.
What you want is totally possible, but it requires that you sit back and rethink your app architecture a little. What you need to do is isolate the functionality that requires admin level access into a windows service, you then set the service to run under the Local System
account (which arguably is slightly more privileged than a regular machine admin). Of course your service can also be set to run automatically on machine start. This means the code in the service gets elevated privileges without ever prompting the user.
The rest of your functionality can stay in your regular app, running under the normal user credentials. The applications that are set to auto start are started considerably after the services, so your service should be available by the time your regular app starts.
Upvotes: 3