Archive: DeleteRegKey does not work as expected


DeleteRegKey does not work as expected
Hi,

I am having a problem with the "DeleteRegKey" instruction. When I try to delete a key that has some subkeys inside my uninstaller, it seems the script only deletes the first subkey but the other subkeys and values remain.

My code looks like this:
"DeleteRegKey HKCU "Software\MyCompany\MyProduct"
so I am not using the /ifempty option.

This only happens in Windows Vista without Service Pack 1 and works as expected on Windows XP and Windows Vista with Service Pack 1.

Any idea?


Thanks in advance,

JJGL


do you run the uninstaller with admin rights? I bet the uninstaller doesn't have the rights to delete all the subkeys.

If runing as admin doesn't work, use IfErrors to check if it sets the error flag after that code.

E.g.

ClearErrors
DeleteRegKey HKCU "Software\MyCompany\MyProduct"
IfErrors 0 +2
MessageBox MB_OK "DeleteRegKey failed"


If it sets the error flag, you can use Sysinternals Process Monitor to check why exactly DeleteRegKey is failing.

PaR