I have an installation that is installed using elevated rights or administrative privileges are required before installation. I was able to set this in AI for this install project with no problem.
Now I have a patch for this installation that is run from the updater. It gives an error when it starts to run the patch because it can’t perform a change in the registry because administrative rights are needed. The updater then exits out.
If I right-click on the shortcut to the updater (check for updates) and “Run as Administrator” then the patch will install with no errors.
How can I give the updater elevated rights or the patch msp file elevated rights? There doesn't seem to be an area I can give these rights in either the AI Patch project or the AI Updates Configuration File project.
Installing resources in per-machine locations indeed requires administrative privileges. On Windows Vista or above the user can gain administrator privileges during installation through the Elevation Prompt.
I'm not sure if I understand your answer. I need the updater and/or patch msp file to "run as adminstrator" or with elevated rights. The way the updater works now is I or the user will have to manually right-click and run as administrator. I want this to be coded in the updater or msp so the user does not have to do this part. I don't mind if the user has to be prompted to run as administrator, but I don't want them to have to right-click and perform this task. How can I code the msp or updater to run as administrator automatically?
OR if you are saying that the updater should already run as administrator because the original install had these rights, then the updater is not running with these elevated rights for some reason. Why? As mentioned above, the only way to run as administrator is to right-click and the update peforms its changes in the registry as expected. Again, how can I code the msp or updater to run as administrator automatically?
Sorry if I misunderstood your answer, but I need a little more explanation.
if you are saying that the updater should already run as administrator because the original install had these rights,
Indeed the elevation prompt should pop-up if you set both target and upgraded to Per Machine installation type from the Install Parameters page.
As a side note, a per-user installation cannot upgrade a per-machine installation and a per-machine installation cannot upgrade a per-user installation.
The article I linked in my last post can help you suppress the elevation prompt while patching per-machine locations.
The update is still not able to complete. As mentioned previously, the only way to get it to work is to right-click and choose “Run as Administrator”. Again, I don’t want the user to have to go through this process. I want it to be automatic but the user can be prompted if necessary.
As you suggested, I changed in both the original install V12.3.1 (target) and in V12.3.2 (update) the “Installation Type” to read “Per-machine only (fails if user is not administrator)” on the “Install Parameters” page. In addition, I do have “Run as Administrator” checked on that page in both cases for an exe build. However, when I try to build both msi files needed for the patch, it automatically unchecks “Run as Administrator” on the “Install Parameters” page.
I then created the msp patch file using the two msi files created above and then generated an Update Configuration File from the patch. I then updated these two files on my website. I uninstalled and reinstalled V12.3.1 to take on the new settings above. When checking for updates with the Updater it says one exists (V12.3.2), it downloads it, but when it gets to my custom action which writes to the LM registry, it fails. Again, if I right-click on the Updater and “Run as Administrator”, then it gets past this point.
Just as a test, I tried installing the software using the target V12.3.1 msi file and it gives the same error that it can't write to the LM registry. Though, right-clicking on the msi file in this case does not give an option to “Run as Administrator”. So the msi’s or msp’s are not being built with “Run as Administrator”, even after changing what you requested. How can I get them to “Run as Administrator”?
What am I doing wrong? I’m trying to get this next version of our software out with this Updater feature included and this seems to be taking too long. This was due last week. Please help!
FYI: I also am going to apply a digital signature to suppress the elevation prompt. I’m in the application process for one and they will be sending my certificate today or tomorrow.
but when it gets to my custom action which writes to the LM registry, it fails
Another setting you can try is to set the custom action with "Deferred, with no impersonation" execution option if you haven't already. This way it will execute under the SYSTEM account with full privileges.
However, can you please make sure you don't have the UAC disabled on that particular machine? If this is not the case, you can also try installing on other(clean) machines and see the outcome.
However, when I try to build both msi files needed for the patch, it automatically unchecks “Run as Administrator” on the “Install Parameters” page.
The administrator rights you are mentioning can be applied only for .EXE files (by OS architecture) through the bootstrapper. When creating a patch you are building a .MSP and it cannot have the option applied.
That did the trick. I followed "here's Run VB EXE-File in "Administrator Mode on Vista" and the updater ran as administrator. The patch then installed with no problems.