I would like to loop through all the registry keys and subkeys in a hive, find the value containing a specified string and replace it by a new one (I am adapting this code using winreg)
So far my code works on the keys whose ownership
is Administrator
and for which Administrator
has full control
but not on the other keys.
I could set the permissions of all my keys so that Administrator has full control but I would like to avoid that. Instead, I would like to only change the permissions of the keys that match the specified string. After the value is modified the permissions should be set back to what they were.
I have seen this answer from 2012 but I would like to avoid installing a software for that.