mustafakuk
Posts: 9
Joined: Tue May 02, 2023 3:32 pm

Uninstall Password 19.2 Version

Tue May 02, 2023 3:41 pm

I want it to ask for a password when uninstalling the MSI package. How can I do that? I've examined old examples. When I do it with VB code, I can't remove my related msi package with a powershell script. Is there a different method to remove it with a password?

Liviu
Posts: 1034
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Uninstall Password 19.2 Version

Thu May 04, 2023 8:17 am

Hello and welcome to our forums,

Please note that it is not recommended to add a password protection for uninstalling the MSI package. The user should be able to uninstall any application from their own PC without any unnecessary barriers. Moreover, password protection for uninstalling could also cause issues such as locking the user out of their own PC or preventing them from performing necessary system maintenance. Instead, you can consider alternative solutions such as educating the end-users on the importance of not uninstalling the application or using a system management tool to restrict access to the uninstall process for users who do not have the necessary permissions.

You can add an EditBox control on the VerifyRemoveDlg dialog to prompt for the password to proceed. You can then condition the "Remove" button to be enabled only when the password entered is correct.
uninstall password.png
uninstall password.png (121.14KiB)Viewed 19596 times

For this scenario you need to check the "Use a single "Uninstall/Change" button" option from the Product Details page. Also enable the Enhanced User Interface to "Always" from the Themes page --> Settings tab.

If you want to always require a password during uninstallation (uninstallation can be performed with basic UI and no dialogs will be displayed), then you will have to develop your own custom action which will implement the functionality and return an exit code different than 0 (zero) when the password is incorrect. The custom action should be added after "Install Execution Stage -> Searches" action group.

Please note that you can develop your custom action with the desired functionality in any programming language you want.

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

mustafakuk
Posts: 9
Joined: Tue May 02, 2023 3:32 pm

Re: Uninstall Password 19.2 Version

Fri May 12, 2023 1:00 pm

first of all thanks, when I do it with this method, I can technically achieve success. but when I do it with this method, it is uninstalled with a powershell script. Also, when I go back and forth on the remove screen, remove appears automatically.

Liviu
Posts: 1034
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Uninstall Password 19.2 Version

Mon May 15, 2023 8:52 am

Hello,
Also, when I go back and forth on the remove screen, remove appears automatically.
This can happen when you add the password and the value is saved. You must clear the property value if you want to reset the button when you return to the dialog. To achieve this you can use a Set installer property value published event on the Back button, to set the property to another value.

Hope this helps!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

mustafakuk
Posts: 9
Joined: Tue May 02, 2023 3:32 pm

Re: Uninstall Password 19.2 Version

Tue May 16, 2023 12:21 pm

In silent installations and uninstalls, these settings do not matter. How can I make them mandatory for silent installations and removals?

Liviu
Posts: 1034
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Uninstall Password 19.2 Version

Tue May 16, 2023 3:39 pm

Hello,

I'm afraid this is the default behavior of Windows Installer. During a silent installation/uninstallation, the entire "Wizard Dialogs Stage" will be skipped. There's no UI during the process.

Please check the msiexec Parameters article.

A silent (or unattended) installation is the ability to install an application package, most frequently an MSI or an EXE, without any user interaction. This means that the user will no longer need to go through the install wizard (and click Next multiple times). The application will be installed automatically by calling the installer with specific silent install parameters. There is no user interaction.

To overcome this, you will have to create your own support in a custom action (VBScript, C#, PowerShell, etc) which will be executed under the Install Execution Stage section.

I hope this gives you some guidance!

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

mustafakuk
Posts: 9
Joined: Tue May 02, 2023 3:32 pm

Re: Uninstall Password 19.2 Version

Wed May 17, 2023 7:12 am

Is there an example of the last thing you said, how can I intervene in the full installation phase?

Catalin
Posts: 6537
Joined: Wed Jun 13, 2018 7:49 am

Re: Uninstall Password 19.2 Version

Thu May 18, 2023 12:42 pm

Hello,

I'm afraid we do not have any examples for that.

Thank you for your understanding!

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

mustafakuk
Posts: 9
Joined: Tue May 02, 2023 3:32 pm

Re: Uninstall Password 19.2 Version

Tue May 23, 2023 11:33 am

Liviu wrote:
Thu May 04, 2023 8:17 am
Hello and welcome to our forums,

Please note that it is not recommended to add a password protection for uninstalling the MSI package. The user should be able to uninstall any application from their own PC without any unnecessary barriers. Moreover, password protection for uninstalling could also cause issues such as locking the user out of their own PC or preventing them from performing necessary system maintenance. Instead, you can consider alternative solutions such as educating the end-users on the importance of not uninstalling the application or using a system management tool to restrict access to the uninstall process for users who do not have the necessary permissions.

You can add an EditBox control on the VerifyRemoveDlg dialog to prompt for the password to proceed. You can then condition the "Remove" button to be enabled only when the password entered is correct.

uninstall password.png


For this scenario you need to check the "Use a single "Uninstall/Change" button" option from the Product Details page. Also enable the Enhanced User Interface to "Always" from the Themes page --> Settings tab.

If you want to always require a password during uninstallation (uninstallation can be performed with basic UI and no dialogs will be displayed), then you will have to develop your own custom action which will implement the functionality and return an exit code different than 0 (zero) when the password is incorrect. The custom action should be added after "Install Execution Stage -> Searches" action group.

Please note that you can develop your custom action with the desired functionality in any programming language you want.

Hope this helps!

Best regards,
Liviu
This method is suitable for me, but now I have a problem. The registry creates two records, which prevents some of my operations. How can I fix this?

note: I do not manually create the registry entry, it happens automatically.

Liviu
Posts: 1034
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Uninstall Password 19.2 Version

Wed May 24, 2023 3:12 pm

Hello,
The registry creates two records, which prevents some of my operations. How can I fix this?
I'm not sure I understand this. The solution has nothing to do with registry keys, it just uses an edit box.

If possible, could you please give me some more details (maybe exemplify with some screenshots)?

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

mustafakuk
Posts: 9
Joined: Tue May 02, 2023 3:32 pm

Re: Uninstall Password 19.2 Version

Mon Feb 12, 2024 1:38 pm

hi again,

I was able to do these operations with the dialog. So, can I intervene from the outside in this password section that I created inside?
I mean, I set the password when I created the msi file, but I want to change it later, can I move this variable to regedit etc.?

Liviu
Posts: 1034
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Uninstall Password 19.2 Version

Tue Feb 13, 2024 10:02 am

Hello,

I'm afraid this is not possible with the above approach.

For this you will have to develop your own custom action which will implement the functionality.

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

mustafakuk
Posts: 9
Joined: Tue May 02, 2023 3:32 pm

Re: Uninstall Password 19.2 Version

Wed Feb 14, 2024 7:10 am

First of all, thank you, can you share an example of a custom action?

Liviu
Posts: 1034
Joined: Tue Jul 13, 2021 11:29 am
Contact:  Website

Re: Uninstall Password 19.2 Version

Wed Feb 14, 2024 2:56 pm

Hello,

Unfortunately, we don't have an example tailored to this specific custom scenario.

However, you have the option to develop your own custom script for this case (e.g. in PowerShell or C#).

Best regards,
Liviu
________________________________________
Liviu Sandu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

mustafakuk
Posts: 9
Joined: Tue May 02, 2023 3:32 pm

Re: Uninstall Password 19.2 Version

Mon Feb 19, 2024 9:21 am

hi again,

When I did it with Powershell, I couldn't get any prompt on the screen, but when I did it with VBS, it worked, but the problem is that when I want to uninstall this application with the command line, I cannot uninstall it because I cannot set the pop-up content.

Return to “Building Installers”