Justin
Posts: 44
Joined: Sun Oct 18, 2020 5:53 pm

Re: Hold the elevated privilege UAC as late as possible

Hi Catalin,
I run the .msi by double click not using command prompt. Does it cause to request administrator privileges again?
If this, how do I build both exe and msi files at same time?
By the way, I use the custom action same as your test setting.

Thanks,
Best Regards,
Justin
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Hold the elevated privilege UAC as late as possible

Hello Justin,
I run the .msi by double click not using command prompt. Does it cause to request administrator privileges again?
In "Custom Actions" page, we can see that the installation process consists of two stages:

- Wizard Dialogs Stage (also called the client process)

- Install Execution Stage (also called the server process)

When launching an MSI by double clicking on it, if it is scheduled to install into a per-machine location that by default requires administrator privileges (e.g. the "Program Files" folder), it will elevate when the user pressed on the "Install" button.

When the user presses the "Install" button is when the MSI goes from the "client" process to the "server" process.

During the "server" process, the system is being modified (e.g. the files are installed, registry entries are written, etc.), therefore this is the reason why the elevation happens right before that.

Now, if your custom action is executed during the "Install Execution Stage", then the custom action should inherit the elevation from the parent process (the "server" process).

Now, you did not quite mentioned how your custom action is scheduled.

When I asked this:
If possible, could you please give me some more details about your custom action so I can further investigate this (e.g. some screenshots of the custom action and its' settings)?
The reason why I asked for the screenshots of the custom action was to see how it is scheduled.

Could you please take a screenshot of the custom action in the "Custom Actions" page and forward that to me so I can have a look over it?
how do I build both exe and msi files at same time?
I am afraid you can not build both an EXE and an MSI from the same build (both being functional on their own, of course). To achieve this, you will need to use "Multiple Builds Configurations".

However, I do not think you need to do that since that is most likely not the cause of this.

Looking forward to hearing from you!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Justin
Posts: 44
Joined: Sun Oct 18, 2020 5:53 pm

Re: Hold the elevated privilege UAC as late as possible

Hi Catalin,
Below link is my test project for your reference. The Custom Action contains backup and restore registry will request administrator privileges twice.
Please help me to solve this issue. Thanks!!

https://drive.google.com/file/d/1bcB6_v ... sp=sharing

Best Regards,
Justin
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Hold the elevated privilege UAC as late as possible

Hello Justin,

I have requested the access to download the files.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Justin
Posts: 44
Joined: Sun Oct 18, 2020 5:53 pm

Re: Hold the elevated privilege UAC as late as possible

Hi Catalin,
Sorry for the inconvenience, I have changed the link as below.
https://drive.google.com/file/d/1bcB6_v ... sp=sharing

Thanks!
Best Regards,
Justin
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Hold the elevated privilege UAC as late as possible

Hello Justin,

Thank you for the provided project file.

I was indeed able to replicate the behavior.

I have managed to avoid this behavior by launching the MSI file elevated from the start.

Is there a requirement that your output package is an MSI file? If not, in order to avoid this, please go to "Install Parameters" page and check the "Run as administrator" option (this will convert your package to an EXE).

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Justin
Posts: 44
Joined: Sun Oct 18, 2020 5:53 pm

Re: Hold the elevated privilege UAC as late as possible

Hi Catalin,
I need to package output as an MSI file, or there are ways to package MSI and EXE at a time. please help me to solved this. Thanks!!

Best Regards,
Justin
Justin
Posts: 44
Joined: Sun Oct 18, 2020 5:53 pm

Re: Hold the elevated privilege UAC as late as possible

Hi Catalin,
Justin wrote: Tue Dec 22, 2020 3:18 am I need to package output as an MSI file, or there are ways to package MSI and EXE at a time. please help me to solved this. Thanks!!
I can package MSI and EXE at a time.

Best Regards,
Thanks!
Justin
Catalin
Posts: 6585
Joined: Wed Jun 13, 2018 7:49 am

Re: Hold the elevated privilege UAC as late as possible

You are always welcome, Justin!

Glad everything works as expected now.

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

Return to “Common Problems”