Video Screencast Help
Symantec Secure Login will be live on Connect starting February 25. Get the details here.

Install SNMP on Windows Servers

Created: 28 Jul 2011 • Updated: 28 Jul 2011
JimChud's picture
+3 3 Votes
Login to vote

Attached is a script i created to install SNMP on servers depending on version of Windows OS.

I used to get the basic batch script to find the OS Version and added in the required install commands and creation of a SNMP config for Windows 2003.

I tied this in to a job that installs and then runs a config SNMP task afterwards to configure the SNMP settings.

The only issue I've found is on 2008 it will not install if Windows Updates are waiting for a restart.

hopefully this helps a few people save some time.

 @Echo off
:: Get windows Version numbers
For /f "tokens=2 delims=[]" %%G in ('ver') Do (set _version=%%G)

For /f "tokens=2,3,4 delims=. " %%G in ('echo %_version%') Do (set _major=%%G& set _minor=%%H& set _build=%%I)

Echo Major version: %_major%  Minor Version: %_minor%.%_build%

if "%_major%"=="5" goto sub5
if "%_major%"=="6" goto sub6

Echo unsupported version

::Winxp or 2003
if "%_minor%"=="2" goto sub_2003

Echo Windows 2003 or XP 64 bit [%PROCESSOR_ARCHITECTURE%]

echo [Components]>c:\SNMPConf.txt
echo netoc=on>>c:\SNMPConf.txt
echo [NetOptionalComponents]>>c:\SNMPConf.txt
echo SNMP=1 >>c:\SNMPConf.txt

sysocmgr /i:%SystemRoot%\inf\sysoc.inf /u:c:\SNMPConf.txt /x /q /r”
del c:\SNMPConf.txt

if "%_minor%"=="1" goto sub7
Echo Windows Vista or Windows 2008 [%PROCESSOR_ARCHITECTURE%]
start /w ocsetup SNMP /quiet /norestart

Echo Windows 7 or Windows 2008 R2 [%PROCESSOR_ARCHITECTURE%]
start /w ocsetup SNMP /quiet /norestart