I have a script changes some snmp community settings on our servers.
It deletes the existing key, creates a new one and populates it with
our new traps. Only problem is that when it creates the new key, the
default vaule looks wrong. It gets assigned a value instead of the (no
value).. its not causing any issues, but was wondering if anyone found
better syntax than what I am using to create a new key.. Here is the
line and below it I posted the whole script
'recreate the key
WshShell.RegWrite
"HKLM\system\currentcontrolset\services\snmp\parameters\trapconfiguration\delltrap\",
1, "REG_SZ"
Whole script
On Error Resume Next
'set the traps.
value1 = "blah"
value2 = "blah2"
value3 = "blah3"
value4 = "blah4"
'create the scripting object
Set WshShell = WScript.CreateObject("WScript.Shell")
'delete the existing key
WshShell.RegDelete
"HKLM\system\currentcontrolset\services\snmp\parameters\trapconfiguration\delltrap\"
'recreate the key
WshShell.RegWrite
"HKLM\system\currentcontrolset\services\snmp\parameters\trapconfiguration\delltrap\",
1, "REG_SZ"
WshShell.RegWrite
"HKLM\system\currentcontrolset\services\snmp\parameters\trapconfiguration\delltrap\1",value1
WshShell.RegWrite
"HKLM\system\currentcontrolset\services\snmp\parameters\trapconfiguration\delltrap\2",Value2
WshShell.RegWrite
"HKLM\system\currentcontrolset\services\snmp\parameters\trapconfiguration\delltrap\3",Value3
WshShell.RegWrite
"HKLM\system\currentcontrolset\services\snmp\parameters\trapconfiguration\delltrap\4",Value4