Archive: How do I make a user level have admin rights during installation?


How do I make a user level have admin rights during installation?
I made an installer that works perfectly with XP. It works with Vista as well but only with administrators.

What if the user wants to install this software but doesn't have the administrator's password (user level at VISTA)? I have tried using the UAC plug in, but this would definitely prompt the user for the admin password.

Is there anyway that could make the installer run by the user as if he's the admin?

Please help... thanks...


The entire point of access levels is that a common user can't just simply gain admin level without so much as a prompt for administrator credentials... so, no - you can't have your installer magically gain admin level if the person running the installer only has user level.

If common users should be able to use your installer, you might have to check why your installer needs admin level and see if you can eliminate that need.


That's right. You have a point. But I was wondering why you can install GTalk even if you only have a user level. I think same goes with yahoo messenger.

I would want to make it work that way if there's any way. I actually made a workaround, you can get to install it but only on the APPDATA folder. I figured you can't install in the PROGRAM files folder if you're only a user.


Your installer is just as broken on XP, it's just that most people run as admin there (but not everyone)


Nope, it works perfectly on XP whatever folder you select... I'm only having problems on Vista.

If you can install Gtalk and YM on Vista without having admin rights, that means, there's gotta be a way you could do that on your own installer.

That's what I'm trying to figure out...


If you try to write to $programfiles without checking for admin rights on XP, your installer is broken!

To install something as non-admin, you must install the program in $localappdata or $appdata


I understand, but that's not what i want to do... :) I want to be able to install to any folder... :D


UAC will also block access to the root of the system drive (C:\ for example) as well as the Windows and Program Files folders. (I'm not totally sure, but I believe the restriction to the root of the system drive might be the difference between XP and Vista.)

MS recommends using the user's profile folder instead if trying to run without elevated permissions. More info here: http://technet.microsoft.com/en-us/w.../cc507861.aspx


UAC facilitates switching between Administrator and Non-Administrator tokens, in order to temporarily elevate permissions for a program w/o using a separate account. Else, it has to do with file system permissions which should be the same or similar between XP and Vista.

- Cannot write a FILE to root but can create a folder in the root; if another user created that folder then they can add their own files but not modify the other user's files.
- Can write to their profile directory, and the Shared Documents folder (they can add their own files but not modify other users' files).
- Write to HKEY_CURRENT_USER, few exceptions: HKCU\Software\Microsoft\Windows\CurrentVersion\Policies is not writeable by non-admin even though it's under their hive


If you select "single user" for the install type, that means the application will be installed in the current user's account.

My understanding is that, if you're an admin the application should be written in HKLM which makes it available to all users. And if you're just a user it should be written in HKCU.

My question is, If I'm an admin and I select "single user" will the application installed be available to all users?


My question is, If I'm an admin and I select "single user" will the application installed be available to all users? [/B]
That depends on where you install it. If you install it within the admin's profile, non-admin users won't be able to access the program. Non-admins also cannot access other users' profiles, via file system permissions and not UAC, if using NTFS as the file system. If it is somewhere where the user can read it then they can open the program.

single user is single user, does not matter if you are admin or not


bedbuffer,
have you tried to set RequestExecutionLevel to "user"? By default, XML manifest is not included and OS decides itself what priviliges are required. It can recognize that EXE is an installer and then requires admin priviliges.


nsfis,

Yes I did, it was the very first thing I considered actually. :D


Last Friday, I just finished creating the installer and it works perfectly with Vista and XP. It sets the installation folder depending on the level of priviledge the user has (admin, user, etc...) and it also bypasses the UAC prompt in Vista.

Thanks...


Do you guys know how to create a software updater? one that silently installs...


I just figured how to... thanks... :D


hi bedbuffer, would you show how to do it?


yes, just check the vpatch sample included in the nsis package. That's how I made the updater...


also, add a line that would read the registry entry of your app (location of the app) so it would know where to install the updates....