SNMP via Script
- Is there a way to have a script configure the SNMP info? More specifically, I need to have a script to configure the service "SNMP Service" and "SNMP Trap". I am running this on multiple versions of Windows 2003 and 2008 (Win 2K3 Standard x64 is the most popular out of these though)
My ultimate goal is to have the following configured via script:
1. in SNMP Service the tab named "Traps" I need to add two community names.
2. Under trap destination I would need it to add two server names for only one of the community names (from #1)
3. in the "Security" tab, in the "Accepted community names" have both the community names from #1. Then assign "read only" to the first community from #1 and "read write" assigned to the sencond community from #1
4. Also want the radio button selected "Accept SNMP packets from any host"
5. In the other SNMP service "SNMP Trap" I would need the service start Automatically instead of manually.
Is this possible??? I have hundreds of servers that I need to run this script on. This will make configuration very speedy with the click of a button (if possible). However I don't need this script to run on multiple servers at once (unless that is also possible. I just need to run it from each server individually. That's fine.
Thank you
Answers
Hi,
As this issue is related to scripting, I suggest discussing it in our MSDN forum. They mainly deal with scripting issues and should be the best resource to troubleshoot this issue.
MSDN forum:
http://social.msdn.microsoft.com/forums/en-US/categories/
I hope you issue can be resolved soon.
Tim Quan - MSFT
- Marked As Answer byTim Quan - MSFTMSFT, ModeratorFriday, August 07, 2009 2:57 AM
All Replies
- Can you not use Group Policy to do the settings for you? If so, you only need to install SNMP onto the servers, which is possible via script. I don't have my script to hand, but I can provide it if needs be, but I assure you the easiest way to do the configuration is via Group Policy.
If shortcuts worked, then they wouldn't be shortcuts would they...- Proposed As Answer byCuppaT Friday, August 07, 2009 10:07 AM
Hi,
As this issue is related to scripting, I suggest discussing it in our MSDN forum. They mainly deal with scripting issues and should be the best resource to troubleshoot this issue.
MSDN forum:
http://social.msdn.microsoft.com/forums/en-US/categories/
I hope you issue can be resolved soon.
Tim Quan - MSFT
- Marked As Answer byTim Quan - MSFTMSFT, ModeratorFriday, August 07, 2009 2:57 AM
Alsoszaa,
Put the following in a file called 'SNMP.txt'
[NetOptionalComponents]
SNMP = 1
[SNMP]
Accept_CommunityName = public:Read_Only
Any_Host = Yes
Community_Name = "public"
Contact_Name = "Name"
Limit_Host = 0.0.0.0
Location = "Location"
Send_Authentication = Yes
Service = Applications, Internet, End-to-End, Physical, Datalink
Traps = 192.168.0.1
Save that somewhere, say root of C:\
Then run this command line, it uses the sysocmgr to install SNMP and reads the config settings from the .txt file.
%windir%\system32\sysocmgr.exe /i:%windir%\inf\sysoc.inf /u:%SYSTEMDRIVE%\SNMP.txt /r
Hope this helps.
If shortcuts worked, then they wouldn't be shortcuts would they...- Proposed As Answer byCuppaT Friday, August 07, 2009 10:07 AM
- I'm in the same boat, looking for a script to automate this chore. MSDN forums aren't usually inhabited by sysadmin types looking for fixes, but maybe the Scripting Guys have a few tricks up there sleeves.
http://technet.microsoft.com/en-us/scriptcenter/default.aspx I configured the SNMP the way I wanted it, then exported the setting out of the registry [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\SNMP\Parameters]

