Current behaviour
When registry editing is prohibited, then keyExists return false.
Expected behaviour
keyExists should throw same ProcessUncleanExitError like other functions:
C: ADD command exited with code 1:
ERROR: Registry editing has been disabled by your administrator.
Proposed solution
keyExists should check for error message "The system was unable to find the specified registry key or value." too. Since reg.exe fails with error code 1 for various reasons. Note: seems to me, that reg.exe does not localize messages (while regedit.exe does localize).
How to simulate
See https://www.online-tech-tips.com/windows-xp/registry-disabled-by-administrator/ :
- Run gpedit.msc,
- Navigate to User Configuration – Administrative Templates – System,
- Change Prevent access to registry editing tools.
- Optional: run gpupdate.exe from command line.