Repairing Registry Settings
One of the most common activities that you'll do with a Windows Installer–based application's registry settings is repairing them. The most common scenario is when a user's settings are so misconfigured that the only choice is to restore them to their original values. This goes for computer settings, too. After the help desk call has exceeded a reasonable amount of time, the technician can put a quick end to the call by repairing the application. The most straightforward ways to repair a Windows Installer–based application are in the user interface:
On the application's Help menu, click Detect And Repair.
In Add Or Remove Programs, select the application that you want to repair, click Change, and then follow the directions that you see on the screen.
Some applications don't provide a user interface for repairing them, so you must use the command line. The syntax of the command that you use to repair an application follows this paragraph. The variable package is the path and name of the package file from which you installed the application. To repair user settings, type msiexec /fu packagepackage. To repair computer settings, type msiexec /fm packagepackage. The command msiexec /fmu packagepackage repairs both types of settings at the same time. These commands work rather well, which you can witness for yourself. Install Office 2003 Editions. Remove its settings, which are in HKCU\Software\Microsoft\Office, from the registry, and then repair the user settings. Windows Installer rebuilds the missing settings.
msiexec /f[p|o|e|d|c|a|u|m|v|s] package
p | Reinstall missing files, but don't check version. |
o | Reinstall missing files or files that are from an earlier version. |
e | Reinstall missing files or files that are from the same or an earlier version. |
d | Reinstall missing files or files that aren't from the same version. |
c | Reinstall missing files or files that are corrupt. This option only repairs files that have a checksum in the package file. Checksum is a bit-level error-checking scheme. |
a | Reinstall all files regardless of their versions or checksums. |
u | Rewrite the essential registry values described in the package file. This includes values in the per-user branches HKU and HKCU. |
m | Rewrite essential registry values described in the package file. This includes values in the per-computer branches HKLM and HKCR. |
v | Recache the source package locally. |
s | Reinstall all shortcuts, and overwrite existing icons. |
NOTE
Repairing an application using Windows Installer is a bit extreme, considering that you have System Restore at your disposal. Chapter 3, “Backing Up the Registry,” describes how to use this invaluable feature to protect configurations. If users' settings get misconfigured, going back to an earlier restore point will likely fix the problem. IT professionals can easily script this operation, too, which enables the help desk to automatically go back to the most recent restore point.