最近公司在上 Nagios 监控,需要批量对Windows 平台启用SNMP服务。

闲言少叙 立马正题

终端计算机批量启用SNMP 服务并进行配置。 1、利用DISM 进行SNMP 服务安装。 ECHO off cd %~sdp0 start /wait dism /online /enable-feature /featurename:SNMP regedit /s "SNMP.reg" 将上述文件保存为SNMP.bat 即可 参考文档:https://www.raymond.cc/blog/add-or-remove-windows-features-through-the-command-prompt/

2、对SNMP 服务的配置,选用直接修改注册表的方式。一下文件直接保存为.reg 方便调用


Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\ValidCommunities] "Public"=dword:00000004 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\SNMP\Parameters\PermittedManagers] "3"="192.168.1.1"