The WiX toolset's "Remember Property" pattern.
This question comes up so often, I should have written this blog entry years ago. The root issue is that the Windows Installer does not save Property values for you. That means if the user enters values in the install UI or passes them on the command-line, those values will be not be present during repair, upgrade nor uninstall. That last one, uninstall, catches people all the time. So let's solve the problem simply then solve it completely.
RobMensching.com LLC