Notepad++ uninstall successful Software center shows failed

Created a script to install and uninstall notepad++. Install works fine, uninstall correctly uninstalls Notepad++ was the software center shows a status of failed. The command I am using to uninstall Notepad++ is:

Execute-Process -Path “C:\Program Files (x86)\Notepad++\uninstall.exe” -Parameters “/S”

I am pretty sure it has something to do with this:

But I do not know how to add a timeout to the installation script.


Notepad++ installer uses NullSoft NSIS. The reference doc for the uninstaller command line is here:

If you use only /S the uninstaller copies itself to a temporary directory and runs a second process from there that will actually do the uninstallation job. The first uninstall process exits immediately, back to the calling script and then to the SCCM client, while the second uninstaller process continues the actual uninstallation, but did not finished yet.

So for NSI uninstallers the solution is to use this command:
“C:\Program Files (x86)\Notepad++\uninstall.exe” /S _?=C:\Program Files (x86)\Notepad++
This way, uninstall.exe won’t copy itself, it will directly and completely do the uninstallation job and only then back to the script.

The script will have then to delete ‘C:\Program Files (x86)\Notepad++\uninstall.exe’ (that could not delete itself) and then delete the installation directory ‘C:\Program Files (x86)\Notepad++’ .