Skip to content
⌘ NSIS Forum Archive

"Elevation" on Windows XP: not always working

7 posts

robbertdam#

"Elevation" on Windows XP: not always working

Hi,

I have an installer that needs to be run as administrator.

On Vista: no problem, I get an elevation prompt.

On XP: it works sometimes:

-> When creating a simple local user with no rights on an XP machine, an login prompt shows up when I run the installer. This allows me to login as admin
-> When logged in on a domain with a domain user (no admin rights), the installer just start to run (and then bumps into a security error).

How come? How can I always force this login prompt to show up on XP?

Thanks for you help!
MSG#
Why didn't you try searching the forums before you asked? This question has been asked hundreds of times before.

requestexecutionlevel admin and/or UserInfo plugin.
Anders#
Originally posted by MSG
requestexecutionlevel admin and/or UserInfo plugin.
UserInfo plugin and optionally requestexecutionlevel (Meaning, if you use requestexecutionlevel admin, you MUST also use UserInfo to deal with UAC off, < NT6 etc)
robbertdam#
Originally posted by MSG
Why didn't you try searching the forums before you asked? This question has been asked hundreds of times before.

requestexecutionlevel admin and/or UserInfo plugin.
I DID search the forums before I asked.

The doc says about "RequestExecutionLevel":
"Specifies the requested execution level for Windows Vista and Windows 7."

My question is about XP.

I already use the UserInfo plugin, so I can determine if I am admin or not. However I want to give this login prompt automatically, not a box saying "please run as admin".

So why the inconsistent behaviour on XP? How to get it working?
MSG#
You can use the UAC plugin to elevate in .onInit, that will runas a second instance of the installer, as admin. That should automatically display the login. (What do you currently use to get the login screen on XP? I don't think I've ever seen XP do that automatically.)
robbertdam#
Thanks, I'm now looking into the UAC plugin.

It appears that the Windows XP I was using for my test has *something* installed on it, so the elevation prompt is automatically shown.