1. 程式人生 > >批處理 方式安裝配置SNMP服務

批處理 方式安裝配置SNMP服務

SNMP

最近公司在上 Nagios 監控,需要批量對Windows 平臺啟用SNMP服務。

閑言少敘 立馬正題

終端計算機批量啟用SNMP 服務並進行配置。
1、利用DISM 進行SNMP 服務安裝。
dism /online /enable-feature /featurename:SNMP
regedit /s "SNMP.reg"
參考文檔: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"

批處理 方式安裝配置SNMP服務