I need to find a partial
text (not full text match) inside the data of all the values of a subkey, or in other words: I need to find a firewall exception on the registry.
The problem that I have is that in my script the For
says that the arrSubKeys
object is not a collection, but it is! (the method itselfs instances a new array not?)
So I can't loop over the values and I don't know why I'm getting this error 'cause I've taken it directly from here in Technet.
I need help to solve this problem and to do the 'find partial text in datas' orders.
Const HKLM = &H80000002
Const Key = "SYSTEM\CurrentControlSet\Services\SharedAccess\Parameters\FirewallPolicy\FirewallRules"
Const MatchData = "Action=Block|Active=TRUE|Dir=Out|App=C:\FTP Manager.exe"
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
objReg.EnumKey HKLM, Key, arrSubKeys
For Each Subkey in arrSubKeys
Wscript.Echo Subkey
Next
Wscript.Quit()
UPDATE:
I've find my error I was trying to enumerate the keys instead of the Values, so now how I can proceed to match partial text in the data of each value?:
objReg.EnumValues HKLM, Key, arrValues
For Each Value in arrValues
...