Is anyone aware of any type of script that could be used to modify the SNMP settings on Windows 2003 and/or Windows 2008 (including R2) servers? We need to "touch" roughly 150 boxes to modify the host traps are being sent to.
Thanks!
Why script when you can use our free tool to do this?
SNMP Enabler for Windows - Save time by remotely installing, enabling, and configuring SNMP on multiple Windows servers and workstations.
http://www.solarwinds.com/register/registration.aspx?program=1382&c=70150000000P2cK&INTCMP=DLIndexA_FreeTools_FreeSNMPEnabler
Jeff
Thank you - we will give that a shot.
I use evntcmd.exe for this:
evntcmd.exe -v 10 events.cnf -s hostnameHere
where events.cnf contains this to add a trap destination:
#pragma ADD_TRAP_DEST YourCommunityNameHere 123.123.123.123
You can obviously do various scripting around this, and my events.cnf is very long - I send a lot of event logs traps to Orion this way, and every server is given a standard trap-sending configuration. I use a Powershell script to retrieve all "up" Windows nodes from the database and do this in bulk. You can optionally use evntwin.exe to get the trap-sending criteria for the events.cnf file.
if you have a way to import a reg file, create one like this (the [-HKEY...] deletes the key first):
Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\RFC1156Agent]"sysContact"="MIS Department - (123) 123-1234""sysLocation"="1324 Main St, Beverly Hills, CA 90210""sysServices"=dword:0000004c[-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\PermittedManagers][HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\PermittedManagers]"1"="localhost""2"="1.1.1.1""3"="1.1.1.2"[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration\<TRAP_COM_STRING>]"1"="1.1.1.1"[-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities][HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\ValidCommunities]"<RW_COM_STRING>"=dword:00000010
oh - I should fully read things first. If you are only changing the trap destination (1), you could use:
reg add \\<computer>\hklm\SYSTEM\CurrentControlSet\Services\SNMP\Parameters\TrapConfiguration\<TRAPSTRING> /v 1 /t REG_SZ /d 1.1.1.1 /f
Though not related to Traps, My VMware template has all correct SNMP settings, and I just need to correct the Location field at times.
Done with:
reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\RFC1156Agent" /v sysLocation /t REG_SZ /d "Datacenter or SITE address, CITY" /f
as a RUN ONCE command.
Regards, -Nap