Archive: MultiUser.nsh


MultiUser.nsh
Hi all,

Maybe a dumb question, but where do I find MultiUser.nsh. It seems google is not my friend when I search for it. :-)

And maybe a good advice, I want to install a program, in case the user has admin rights I want to install it for all users, if the user running the program has no administor rights I want to use it for only that user. I guess this will also work for Windows7 with UAC. As far as I have seen, I should use MultiUser.nsh for it. Right?

Thanks for your response.


It's shipped with NSIS. NSIS\Include\MultiUser.nsh

But you should not use MultiUser.nsh. Offering the user a choice between single user and multiuser installation is fundamentally flawed. To understand why, observe the following case study:

Let's say there's two users, Peter (admin level) and Steve (normal user level). If Peter starts the installer, it automatically has admin access. But if Steve starts the installer, the installer will either say "please run as admin" and quit, or automatically show a RunAs dialog to get the admin access it desires. Steve would then run the installer as admin using RunAs. He could select the Peter account, or the built-in Administrator account, or another account with admin access.
However, as you can see, at this point it's no longer certain who originally started the installer: If the installer is running from the Peter account (having admin access), it could have been launched by Peter, but could also have been launched by Steve! Generally speaking: If your installer has admin access, there is no way to know who it was originally launched by. This in turn means that, if you offer the choice to do a singleuser installation, you'll risk installing as the wrong user (Peter instead of Steve).

It is therefore pointless to use MultiUser.nsh. If your installer runs at userlevel, you must always do a singleuser installation because you don't have admin access. If your installer runs at admin level, you must always do an alluser installation because you don't know who originally executed the installer.

The reason why MultiUser.nsh was used (semi-)successfully in the past was that on WinXp, most users are admins. This is extremely unsafe (which is why Microsoft did things differently in Vista), but it was generally the case. If every user is an admin, it makes sense to differentiate between single/alluser installations. Every user has the ability to install to all user accounts, after all. But when not all users are admin (and a technically advanced user would never make all users admins!), using multiuser.nsh causes your installer to be broken.



To answer your second question: In order for your installers to work properly in Vista/7, you need to set "requestexecutionlevel" to user or admin. The problem is, you can only set it once. So you have to decide beforehand whether you want to do a singleuser or alluser installation, you cannot decide it at runtime. For more info, see this thread: forums.winamp.com/showthread.php?t=330624


Thanks for your quick response and advice. I will study the issue.