Skip to content
⌘ NSIS Forum Archive

Installation fails for non-admins under WindowsXP

4 posts

cowwoc#

Installation fails for non-admins under WindowsXP

Hi,

I just found out that when a user runs my installer under WindowsXP as a non-Administrator the InstallDir file extraction will fail with some cryptic error message about not being able to write <output_file>.

My InstallDir points to a directory in C:\Program Files so I am thinking this is a permissions problem. Fair enough, but then how do I get Windows to elevate my permisions to admin (I suspect this isn't possible in XP)? Alternatively, how do I warn the user on startup that the installer must be run as an admin?

This seems like a common problem. I'm rather surprised I haven't found a mention of it on the forums or Google.

Thank you,
Gili
Anders#
use the userinfo plugin in .onInit or .onGuiInit and show a messagebox and quit if the user is not admin
MSG#
Indeed, you cannot 'automatically' elevate the user to Admin in Windows XP. You need to use the UserInfo plugin (UserInfo::GetAccountType) to determine whether or not the user has Admin access. Typically you can do this in .onInit .

(Note that on Vista/Windows7 you *also* need to use the UserInfo plugin, in case the user has disabled his UAC. So just use it always.)


Edit: Heh, too late.