Attached is a script i created to install SNMP on servers depending on version of Windows OS.
I used http://ss64.com/nt/ver.html 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 Setlocal :: 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 goto:eof :sub5 ::Winxp or 2003 if "%_minor%"=="2" goto sub_2003 Echo Windows XP [%PROCESSOR_ARCHITECTURE%] goto:eof :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 goto:eof :sub6 if "%_minor%"=="1" goto sub7 Echo Windows Vista or Windows 2008 [%PROCESSOR_ARCHITECTURE%] start /w ocsetup SNMP /quiet /norestart goto:eof :sub7 Echo Windows 7 or Windows 2008 R2 [%PROCESSOR_ARCHITECTURE%] start /w ocsetup SNMP /quiet /norestart goto:eof