Archive: Running UAC plugin as admin - issue


Running UAC plugin as admin - issue
  Hi,

Apologies if this has been answered before, but I can't seem to find an answer on the forums. I have written an installer under Vista, all works fine when I dont have UAC enabled under Vista. At all times, I am logged into Vista as an admin user.

Here is the problem. I am modifying my installer so that any Vista UAC prompts that appear, it should deal with them. I am falling over on the first hurdle where I want my installer to be elevated to admin level. Here is my code, relevant bits:


!include "UAC.nsh"
...
RequestExecutionLevel user
...
Function .OnInit
InitPluginsDir
${UAC.I.Elevate.AdminOnly}
FunctionEnd


Here is what I see:

1) Installer runs, creates a process setup.exe
2) Another process is created too, setup.exe
3) Installer fails with error message "This installer requires admin access, aborting!"
4) Installer fails with error message again "This installer requires admin access, aborting!"
5) Installer quits, processes all gone.

I have UAC turned on. I am admin user logged into Vista. (Maybe I need to be logged in as standard user?). I read in the forum that even if I am admin user, Vista does not run the installer process as admin user, runs as standard user?

Maybe I missed something out?

Any code/advice would be really helpful.

Thanks
Riz

Sorry, I must be missing something with what you are trying to do. Why don't you just do:


RequestExecutionLevel admin 

>
and not use that plugin at all?

What I am trying to do is use UAC plugin with my installer and run as admin.

I have tried:

RequestExecutionLevel user
RequestExecutionLevel admin

I tried both, I am running Vista as admin user and have the UAC enabled.

It fails both times with error that I am not admin, I need admin privileges. The code I used in the .OnInit function is:


Function .OnInit
InitPluginsDir
${UAC.I.Elevate.AdminOnly}
FunctionEnd

The first code you posted looks ok, are you saying you don't get a UAC consent dialog at all?


Sorry, I didnt make it clearer, I do get a UAC consent dialog, I click allow, and then I get error where it says that "I need admin rights, aborting".

Riz


the UAC_AdminOnly.nsi sample has the same problem?


Hi Anders,

I have re-enabled UAC on my user account, rebooted machine and I have tried the UAC_AdminOnly.nsi script in the examples folder.

It crashes! It says, "UAC_AdminOnly.exe has stopped working, windows is looking for a solution!", no UAC confirm prompts or anything.

I have another user account, called testuser. Tried it with that, it has user privileges and same result, application crashes.

I did try my installer again, I get the UAC prompt, I allow it, and then it loads twice, and fails twice with the "The installer requires admin privileges, aborting!".

I am running vista x64 and I am using the Unicode UAC dll in the plugins folder of NSIS 2.45

Any help or suggestions is much appreciated.

Thank you
Riz


unicode uac plugin and unicode nsis?

Try the ansi plugin and ansi nsis...