Something that worked for me for uninstalling the previous install was to replace inside installscript.js: installer.execute(dir + "/maintenancetool.exe", ["purge", "-c"]);
with
component.addElevatedOperation("Execute", dir + "/maintenancetool.exe", "purge", "-c");