Windows Installer with Administrator rights - wix

I use Wix toolset 3.5 and am interested to know if there is any windows installer which installs only for the administrator?

There can be more than one user with administrative privileges, so I would install for all users and set up the application to require admin rights at start-up. One way to do that is with an application manifest:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb756929.aspx

MOreover, in addition to the answer of #Wim and comments, u can try to create a logic of ur installer based on WiX flag Privileged. it will help u to install some features (or even components) only for admin user (this flag check if the current user has admin rights). Usage of this flag is just simple:
<Component Id="" Guid="">Priveleged</Component>
and in this case component will install only when the current user has an admin rights. hope will help

Related

Bootstrapper to check admin rights in a system

Is there any possibility where wix bootstrapper checks whether user has admin privileges so that admin-msi can be installed, if not a non admin-msi is installed.
basically how to provide install condition inside chain to check windows version and privilege property.
How to make major and minor upgrades for wix bootstrappers.
As far as I know, you do not let the Wix bootstrapper "check whether user has admin privileges", but you actually specify the admin rights for the Wix installer so it can perform the installation properly. You would do so by specifying the follow Package properties:
InstallPrivileges="elevated"
InstallScope="perMachine"
In terms of functionality, this means that a User Access Control window will appear asking the user to allow the Wix installer to proceed with the installation. If the user does not happen to have an administrator account (or an account with administrative rights, however you want to describe it), Windows would require the user to type a username and password of an account that does have administrative rights.
Have a look at the following StackOverflow answer.
Hope that helps you!

How to check in WiX, if user has admin rights?

I have programmed a Bootstrapper application with WiX 3.8, which installs IIS Express 8.0 and activates IIS-features.
But the feature-activation only works, when the user is a local administrator at least.
How can i check in a WiX-Bootstrapper, if the user has admin rights?
Thanks in advance!
See:
Burn Built-in Variables
•Privileged - non-zero if the process could run elevated (on Vista+)
or is running as an Administrator (on WinXP).
This is similar to the Windows Installer Privileged property.
Also check that you are using the PerMachine attribute on the ExePackage element if you are using it.

Wix Installer: Error 1925 when using silent installer

In my wix setup, I use InstallScope="perMachine". In the interactive setup, there is no problem and it installs my application perfectly. However, when I try to install it from command line using /qn, I get the following error.
MSI (s) (60:EC) [11:51:05:268]: Product: ClickShare Launcher -- Error 1925. You do not have sufficient privileges to complete this installation for all users of the machine. Log on as administrator and then retry this installation.
Could anyone tell me why it gives such problem only in silent installation? Does command line have different user privileges?
Can I somehow detect if the user has required privileges and install the application perUser instead of perMachine? Would this be a solution?
Thanks.
You can try to set the install per user / per machine code as a parameter
C:\Users\xxxxx\Desktop>msiexec /i "program.msi" MSIINSTALLPERUSER=1 ALLUSERS=2 /qn
this helped us on a application that did NOT require admin priviledge on interactive, but did require admin priviledge on silent mode....
maybe it helps some other users in the future... (from google searches)
Starting with Windows Vista, MSI installs running from a standard user process requiring elevation cannot do so when running silent. This is due to UAC. Elevate the process prior to invoking msiexec.

Privileges for installing executables with nsis

I need to write an installer for some executables. The user might copy them wherever he wants but usually this is performed in C:\Program Files\MyProgram
If there's visual studio installed I also need to copy something to system32 (and that requires admin rights I suppose).
Does that make sense to support normal users and admin users? I mean: if I need to install something I always need admin rights, is this correct?
Supporting both can be tricky but it can be done by using RequestExecutionLevel highest and then checking if you actually are admin with the UserInfo plugin. You would then have to tell the user to force the installer to run as admin if they are not already when you detect VS.
A normal user cannot write to $programfiles so you have to default $instdir to $localappdata\Programs\Yourapp. You should also take a look at SetShellVarContext, it will help you with the HKCU vs HKLM issue...

WiX - Elevating (or reducing) privileges at install time

I am working on a project that has been using 2 VD projects to distribute admin and user versions of installations, and now I need to switch to WiX. It was a bit painful experience with lack of documentation and all, but I managed to make something of it.
However, there is still one problem: I want to make only one .msi which will allow user to choose whether he wants to install as admin or as user. If he chose user, I don't want to ask him for elevation (as he doesn't need it), also if he chose admin, I don't want the installation to crash but to ask for privileges.
My current solution crashes in admin mode if I set InstallPrivileges to limited because the user doesn't have the permission to install, and it prompts for elevation in user mode if I set it to elevated.
My opinion is that there is no way to fix this because of compatibility with MSI, but perhaps there is some way to change privileges from elevated to limited in install time that I'm missing.
In conclusion, I want to know these things:
Is it possible to change privileges at install time
If there is no way to do so, what is the best workaround for this problem (exporting 2 .msi files or something)
One solution is to build two separate installers and then launch them via a custom WiX bootstrapper (aka Burn). The bootstrapper would be in charge of displaying the UI and launching the appropriate .msi.
Or you could separate the "admin" features into a separate .msi and then use a custom bootstrapper to install both .msis if the user selects an admin install.