velja
Posts: 45
Joined: Tue May 14, 2013 12:01 pm

MSI allow run as administrator only

We have an installer for an outlook add in. The project has 2 builds: single MSI and single EXE.
MSI is built for enterprise users so they can deploy to groups of computers using SCCM, assuming that the MSI will be started from an elevated process.
However, it happens very often that users use the MSI by double-clicking it. In that case, installation completes successfully, but the add-in registration which is done by a custom action (that executes adxregistrator.exe) fails with the error:

Code: Select all

Exception Source:      AddinExpress.MSO.2005
Exception Type:        System.ComponentModel.Win32Exception
Exception Message:     Access is denied
Exception Target Site: CreateSubKey ... 
Under Install Parameters, Installation Type is set to Per Machine only (fails if user is not administrator) and the UAC dialog is displayed after clicking Install on VerifyReadyDlg. The same happens when lunching the single exe, but the single exe successfully executes mentioned custom action i.e. it successfully writes to the registry and registers the add-in.

The problem, from the user's perspective, is that the MSI installer seemed to run, and seemed to complete but the add-in doesn't appear in the Outlook.

We need a way to successfully register the add-in when a user, that has necessary permissions, starts the installation by double-clicking it and stop the installation with a meaningful message for the user without required permissions.

If this is not possible we need a way to stop the installation if it is launched by double-clicking the MSI and display a message instructing the user to use msiexec from an elevated command prompt.
Catalin
Posts: 6584
Joined: Wed Jun 13, 2018 7:49 am

Re: MSI allow run as administrator only

Hello,
MSI is built for enterprise users so they can deploy to groups of computers using SCCM, assuming that the MSI will be started from an elevated process.
However, it happens very often that users use the MSI by double-clicking it. In that case, installation completes successfully, but the add-in registration which is done by a custom action (that executes adxregistrator.exe) fails with the error:
From the above, it looks like you are using a "Launch File" custom action that launches your executable ("adxregistrator.exe") and then this executable registers your add-in.

As per the "Launch FIle" article:
If the package is running with Administrator privileges, the Launch File custom action does not inherit the elevated privileges from the package. If you need to run your custom action with elevated privileges, you need to check "Run as Administrator" option for the custom action in question.
With that being said, could you please check the "Run as Administrator" option for your custom action and let me know if everything works as expected?

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
velja
Posts: 45
Joined: Tue May 14, 2013 12:01 pm

Re: MSI allow run as administrator only

It is "launch installed file" and has no run as administrator option. I will try Launch file and will let you know. I hope I can make it launch installed file. Thanks.
Catalin
Posts: 6584
Joined: Wed Jun 13, 2018 7:49 am

Re: MSI allow run as administrator only

Hello,
I will try Launch file and will let you know. I hope I can make it launch installed file. Thanks.
Sure thing.

Please make sure to execute the custom action after the "Add Resources" action group and have its' "Execution Time" set to "When the system is being modified (deferred)".

Hope this helps.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”