MSI error: requires administrative rights - wix

It works on Win7 when I run msi file from local disk and from network share.
But when I run msi file on Win8-10 I get an error:
This application requires administrative rights
I set for Product:
InstallScope="perMachine"
InstallPrivileges="elevated"
Also, I have 10 custom actions (.NET).
How I can fix it?

Have you tried running it from elevated command prompt?
Open Start, type "cmd", right click on "cmd.exe", click "Run as administrator". Then navigate to your MSI file and use msiexec /i "yourmsi.msi"
If you want your installer to start elevated itself, you can create a bootstrapper application (executable file) to run it.

Related

Set WIX MSI Package to write log to same file as the bootstrapper/burn log file

I have a log file that is written to the installation directory by the MSI. This log file contains code I've written to help with troubleshooting installation issues within the MSI package. The bootstrapper also has its own automatic log file. Is there a way for me to set my MSI to log to the same file as the bootstrapper?
Why do I want to do this?
If an install fails, the bootstrapper displays an error screen with a link to the bootstrapper's log file. This is the information my clients send me when they have problems during installation, but this information is useless to me. I'd love it if this log could also capture all of my MSI troubleshooting information.
You can get the path of yout bootstrapper file and store it in a variable , then when u executing the msi file
"/c msiexec /i Blabla.msi /L*v bootstrapperLogFilePath"

Cannot run msi as administartor

I have written an msi which deals with registry. So, i have to run the msi as admin.
when i directly click and launch the Msi,I get the following error to modify the ini file "Access to the path is denied"
It works fine if i launch the msi from command prompt(Right click as administrator.)
I tried all the below suggestions but none of them is working. please assist how to run msi as admin.
Package Id="*" InstallerVersion="200" Compressed="yes" Platform="$(var.Platform)" InstallPrivileges="elevated" AdminImage="yes" InstallScope="perMachine"
CustomAction Id="UpgradeSelectedVersion" BinaryKey="CustomAction" DllEntry="UpgradeSelectedVersion" Execute="deferred" Impersonate="no"
Property Id="ALLUSERS" Value ="1"
or
Property Id="ALLUSERS" Value ="2"
Try the following:
<Property Id="MSIUSEREALADMINDETECTION" Value="1" />
Otherwise, you could wrap your installer in a wix managed bootstrapper application, a bit more work though. Then you add settings to your manifest file.
That custom action is deferred, which means it must be running in the InstallExecuteSequence, which should be elevated and running with the system account if you have InstallScope per machine and elevated privileges.
Don't mess with the ALLUSERS property because WiX just does the right thing. InstallScope per machine and elevated privileges will make it work. If you accidentally turn it into a per user install by messing with ALLUSERS then it will not be elevated and it will fail.
You should be seeing a UAC elevation dialog after the UI sequence. If you are not seeing this dialog then the install will not be elevated. Again, that might be related to you changing ALLUSERS. If you are installing this in silent mode then it will also fail because silent really does mean silent, and it will not show the elevation dialog and your CA will not run elevated.
It's possible that your failing custom action is not the one you posted, which is deferred and therefore after the elevation prompt. If you have a custom action in the UI sequence then it will not be elevated (unless you run the MSI from an elevated prompt) so that may explain the issue you are seeing.

how to create installation log file in Target folder in wix

i am using the following command to see the logs in wix installer.
msiexec /i "D:\WixProjects\DFServicesWixSetup\DFServices\bin\Debug\DFServices.msi" /L*V "D:\DFServices.log"
but this command is trying to install the msi again.
I want to execute this command from wix after finishing the installation and log file need to save in installed folder.
can any one help me on this.
You need to decide in advance if you want Windows Installer to make a log file. You also need to decide in advance where it should go. If you want it to end up in the install folder then you either need to copy it there after installation or specify the install folder in advance, too.
In Windows Installer folders are controlled by properties. You can specify such properties in the command that starts installation. The name of the property for the "install folder" depends on how the installer authoring; INSTALLFOLDER is one typical name.
So, you could do this with a command like this:
msiexec /i "D:\WixProjects\DFServicesWixSetup\DFServices\bin\Debug\DFServices.msi" /L*V "D:\path\DFServices.log" /qb INSTALLFOLDER="D:\path"
The /qb switch is reduce the UI such that the user is offered the chance to change the installer folder. It may more may not be need for your installer, depending on what dialogs its UI normally shows.
So, the first step is to figure out which property sets the install folder in your installer.

CustomAction error with IIS : UnauthorizedAccessException

I get the following exception when I double click my MSI package
CustomActionException: System.UnauthorizedAccessException: Filename: redirection.config
Error: Cannot read configuration file due to insufficient permissions
at Microsoft.Web.Administration.Interop.AppHostWritableAdminManager.GetAdminSection(String bstrSectionName, String bstrSectionPath)
at Microsoft.Web.Administration.Configuration.GetSectionInternal(ConfigurationSection section, String sectionPath, String locationPath)
at Microsoft.Web.Administration.ServerManager.get_SitesSection()
at Microsoft.Web.Administration.ServerManager.get_Sites()
...
It does this because it's trying to access the path C:\Windows\System32\inetsrv\config from inside a Custom Action
Now if I ran the MSI from PowerShell, where you're running as Administrator, it seems to work fine but the default double-click invocation does not work
Other than adding myself to the UAC of that folder, is there anyway for my CustomActions to run with elevated privileges?
I tried the Package-level attribute of InstallPrivileges="elevated" but to no effect
You need to use Bootstrapper to run the msi in admin mode by default. You can use Wix Bootstrapper to do that. Or you can use any third party tool like WinZip Self extractor or Inno Setup to run the msi file. It will run the msi as administrator always.

ProgramFilesFolder Set to C:\ when using /a switch for msiexec

I have an .MSI installer that I created using WIX and works fine when opening the file from windows explorer or installing from a command window using msiexec /i. The problem is that I need to use /a to install it using a group policy when the computer turns on.
When using the /i option the ProgramFilesFolder value is set correctly to "C:\Program Files (x86)\".
When using the /a option the value of ProgramFilesFolder is set to "C:\", and then I get an error (on the Log) that says:
The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2203. The arguments are: C:\Referrals.msi, -2147287035,
Note: I am not running the .MSI file from "C:\"
Try
msiexec /a TARGETDIR="c:\temp\location" /passive
I think you may have the msiexec.exe command line mixed up: /a is admin install. This is essentially a command to create a network installation point with extracted files to use for installation on a lot of computers. This ensures the source files are available for patching, self-repair, repair, reinstall, etc...
To deal with advertisement and group policy you need to use these command line options. So a very basic operation would be advertise product to all users silently and write a log file:
msiexec.exe /JM "Installer.msi" /QN /L* "C:\msilog.log"