1
votes

Does anyone know how to remove the HKEY_CURRENT_USER registry keys for all users on Windows 7? I need to remove all the registry keys for our product during uninstall. There could be many users using the product, each having registry entries under HKEY_CURRENT_USER. I need to do this from the uninstall script (InstallShield), but if I can do it from C++ or C#, I can probably call the code in a dll during uninstall.

1
Just a comment on this issue: what exists in the user profile and the HKCU section of the registry is essentially user data, and you should not assume you can delete it all by force. What if they want to re-install later? What if there are license keys in there? Or other, important settings that people want to keep? Cleaning out these locations is not recommended. Rather, provide guidelines on your support pages on how to clean it out manually, if people really want to. And consider providing a detailed description of what each option really is for.Stein Åsmul

1 Answers

1
votes

Basically you need to Enum though all of the sub-keys in HKEY_USERS, looking for the specific path you want to delete.

I don't know if Installscript can do this, but I've done in it in a C++ custom action dll before. Look at this MSDN link it describes how you could do it in general. You'll need to sequence the custom action correctly for it to have the permissions required to access and delete in everyone's CU hive.