Archive: Installing into a selected user account


Installing into a selected user account
I want to allow the user to select a user account for installation. So far, I can escalate the current user to admin, show a list of all available users, and pre-select the current user account. My problem is getting the SetShellVarContext to reflect the selected user account when it is set to "current". I need access to HKCU and LOCALAPPDATA for that user.

I've looked at multiuser.nsh but it doesn't seem to do what I want.

Any advice would be appreciated.


Why not just have the user run the installer, no need to elevate or anything, that's how most setups do this.

If you want to do it the hard way, you must load the users profile and redirect HKCU with RegOverridePredefKey (windows2000 and later, call with the system plugin). There is no way to override the folder constants in nsis, the best you can do is to get the path with SHGetFolderPath and use that path and not $localappdata, but to do this, you need the users token, and to get the token, the user needs to provide the password IIRC. Do you really want the user to first enter admin credentials and then credentials for a second user?


Originally posted by Anders
Why not just have the user run the installer, no need to elevate or anything, that's how most setups do this.
I had a request for this functionality so I was researching the possibility. You're right, it is the hard way. I'll just require them to run the installer from the user account they want it installed into.

Thanks for the reply.