So basically, I'm trying to use AccessControl to gain control of several registry keys before changing their permissions to FullAccess for Everyone, then deleting them. Windows Vista forces every user, including administrators to first take control of a registry key before they can make any modifications to it, if they do not already have explicit write control.
I've been successful with GrantOnRegKey:
AccessControl::GrantOnRegKey HKLM $KeyPath "Everyone" "FullAccess"This works perfectly.
I haven't had the same success with SetRegKeyOwner.
AccessControl::SetRegKeyOwner HKLM $KeyPath "user"When I pop the errors off the stack for a few of these SetRegKeyOwner, GrantOnRegKey owner sequences, there are no errors for GrantOnRegKey, but for SetRegKeyOwner calls I get the following for the first:
Cannot apply new ownership.Then for the rest:
Error code: 0
Cannot apply new ownership.Error code 997 is ERROR_IO_PENDING, which doesn't really make sense to me, as permissions changes work, and then the first error code reads as 0 (even though it shouldn't error on 0). The user name is correct, because if I put in a bad one, it gives me a bad trustee error.
Error code: 997
Any ideas?...