Relevance and action

(imported topic written by okole91)

Hey all…I need some help.

I need to inspect the regkeys under hklm\system\currentcontrolset\control\print\monitors\standard tcp/ip port\ports*

each key under will have a value named “snmp enabled”. I need to have the fixlet to be relevant whenever “snmp enabled = 1”. The problem is that all of the keys under “ports” are dynamic.

Once I determine what is relevant, I need an action that will set the value “snmp enable” to 0.

Being a FNG…any help will be much appreciated.

(imported comment written by NoahSalzman)

This is a good place to start:

q: (items 1 of (values whose (name of it is “SNMP Enabled” and it is 1) of it, names of it) of keys of key “hklm\system\currentcontrolset\control\print\monitors\standard tcp/ip port\ports” of registry)

A: 192.168.1.2

A: 192.168.1.3

A: 192.168.1.4

T: 0.947 ms

I: plural string

(imported comment written by NoahSalzman)

Here is an Action Script that uses the aforementioned relevance to change the registry settings:

delete __appendfile
delete snmp_enabled.reg
 
appendfile Windows Registry Editor Version 5.00
appendfile 
appendfile {("[HKEY_LOCAL_MACHINE\system\currentcontrolset\control\print\monitors\standard tcp/ip port\ports\" & it & "]" & "%0d%0a" & "%22SNMP Enabled%22=dword:00000000" & "%0d%0a%0d%0a") of (items 1 of (values whose (name of it is "SNMP Enabled" and it is 1) of it, names of it) of keys of key "hklm\system\currentcontrolset\control\print\monitors\standard tcp/ip port\ports\" of registry)}
move __appendfile snmp_enabled.reg
wait regedit /s snmp_enabled.reg