using NISIS uninstaller to create an uninstaller - nsis

I am getting an error when I am trying to uninstall an application. I used NSIS to make installer and uninstaller for it. The application is uninstalled but it is not getting removed from the add/remove programs. the error looks like "an error occurred while trying to uninstall it may have already been uninstalled"

You need to delete the registry key relation to the Add/Remove Programs registration in your uninstall section.
See also the last paragraph of section "Required values" here.
For example, it could look like this:
Section Uninstall
; ...here the existing uninstall code goes...
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\WhateverNameYouHadUsedHereBefore"
SectionEnd

Related

Electronjs - Delete registry entries when uninstalled

I need to delete Windows registry entries created by the application when the application is uninstalled.
The application is packed with electron-builder and i need to delete registry entries whether it is installed with .exe the with the windows store (appx)
What's the best way to accomplish this?
You can try to read this documentation https://www.electron.build/configuration/nsis.html.I am building an application with electron-builder too but I had not yet asked myself this problem. Thank you :)
" deleteAppDataOnUninstall = false Boolean - one-click installer only. Whether to delete app data on uninstall. "
you can add a custom nsis script in electron build. Use include option
https://www.electron.build/configuration/nsis.html#custom-nsis-script
then you can add below macro in the script file
!macro customUnInstall
DeleteRegValue HKLM "Software\Microsoft\Windows\CurrentVersion\Run"
"SomeLeafLevelEntry"
DeleteRegKey HKLM "SOFTWARE\XYZApp\AppTopLevelKey"
!macroend
that should delete the registry values
More info : https://nsis.sourceforge.io/Registry_plug-in#Delete_Registry_Key_.28same_as_DeleteRegKey.29
https://nsis-dev.github.io/NSIS-Forums/html/t-197518.html

NSIS: Writing to registry (not HKLM)

Please help me: I want to write some data to registry. You might say "Wait, wait, this is one of the basic features in NSIS!", but, I want to write to the app registry (HKCU, not HKLM). The main purpose is: when the installer installs my product it also installs my update manager. I just want to write the product installation directory to the Updater branch, so it can further fetch the update package and install it to the product directory.
If you have RequestExecutionLevel admin in your script and you are installing to $ProgramFiles then you are doing a machine/all users install and the installer should not write to HKCU. Your application must initialize its entries in HKCU and AppData the first time the user runs it. You cannot do it in the installer because UAC might run the installer as the "wrong" user.
If you have RequestExecutionLevel user in your script then you are doing a single user install and the installer should only write to HKCU and [Local]AppData.

how to check software installed in NSIS?

i have created an installer using NSIS to install a software say googletalk in my system using following NSIS script ,
Name "installer"
OutFile "new_setup.exe"
InstallDir "$PROGRAMFILES\Google talk"
Section
SetOutPath $INSTDIR
execWait '$DESKTOP\googletalk-setup.exe'
SectionEnd
Now if i execute the installer once again, before installing it should check whether that software already exists or not.
So in NSIS how to achieve it ?.
Please tell me with code.
Thanks in advance!.
During installation, you need to create informations for uninstall in registry. (visible in Add/remove program on Windows control panel)
I advice you to follow this example :
http://nsis.sourceforge.net/Add_uninstall_information_to_Add/Remove_Programs
Then on your ".onInit" function, you just have to check these values with a ReadRegStr :
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.2.12
Hope this can help you.

Folder in start menu/installation folder still exists,After uninstallation using NSIS script?

I have written nsis script for Java project.once i have clicked uninstaller.exe
Start menu >all programs >my application
all the files are removed successfully from location of installed.but the problem is, folder in STARTMENU/installation folder still exists,after clicking uninstallation.I dont know why this happened? I have used windows 7.
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$(^Name)"
Delete /REBOOTOK "$SMPROGRAMS\$StartMenuGroup\Uninstall $(^Name).lnk"
Delete /REBOOTOK $INSTDIR\uninstall.exe
I have used above code.Can anyone help me?
Where is the code to remove the directory? RMDir "$SMPROGRAMS\$StartMenuGroup"
It is also important to use RequestExecutionLevel so you don't run into compatibility issues...

NSIS Identifying multiple uninstallers

I have multiple instances of a program and each has its own install directory with its own copy of the uninstaller. The installer has a field called "$instance" entered by the user which is recorded in the registry like this:
HKLM "SOFTWARE\#vendor.name#\#product.name# #product.version#\installs\$instance"
which works fine. This key contains the root path of the install.
I would like to uninstall the instance of the program that corresponds to the uninstaller that is executed but the Uninstall section does not retain the variable "$instance" that the user entered at install time.
Any ideas?
Example:
Section Uninstall
; THIS does not display the instance name. :(
MessageBox MB_OK "$instance"
SectionEnd
You can store custom data at the end of the uninstaller.exe without breaking the CRC check, or alternatively store it in a .ini in the same directory as the uninstaller (I do this all the time, just name the ini file "uninstaller.dat" or something like that so users don't mess with it)

Resources