Thanks - you can see in the first run that the registry key is gone at the end, while in the second run it still exists. If you run RegEdit, you can see that the first test creates the root key in the wow6432node subkey, while the second test creates it directly in the SOFTWARE key.

If I had added another "If KeyExist" code block after deleting the first key, you'd have also seen that the Test subkey is deleted with the setting OFF but is not when the setting is ON.

BTW - you'll need to manually delete the HKLM\SOFTWARE\TEST reg key after the second test. ;\)

Glenn
_________________________
Actually I am a Rocket Scientist! \:D