I am able to enumerate HKEY_USERS\UserSID
easily but I need to dig 6 levels deeper to look for a string value. If that string value exists I need to then delete the parent and all sub keys to the parent key.
The full path to the "parent" key is: HKEY_USERS\UserSID
If the string value Parent
\Label = "AIT" then delete the 7 subkeys of the parent and the parent itself.
Unfortunately the string value is not the same for all user profiles and I need to only delete those that = "AIT".
I have scoured all over and can't find a way to do this.
Here is what I have so far:
Const HKU_USERS = &H80000003
strComputer = "."
Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
strIPDKeyPath = "\Software\FileNET\IDM\Preferences\Libraries\DefaultIMS:AIT:FileNet"
DeleteIPDSubkeys HKU_USERS, strIPDKeyPath
Sub DeleteIPDSubkeys(HKU_USERS, strIPDKeyPath)
objRegistry.EnumKey HKU_USERS,"", arrSubkeys
If IsArray(arrSubkeys) Then
For Each strSubkey In arrSubkeys
'how to enumerate the subkeys of strSubKey to ultimately
'delete HKU_USERS\UserSID\strIPDKeyPath and it's subkeys
'if the string value of "Label" = "AIT".
objRegistry.DeleteKey HKU_USERS, strIPDKeyPath