@echo off set snmp_install_op=%1 set SNMP_INSTALL=true set min_bnad=3 set vbs=filever.vbs set bnad=%SystemRoot%\System32\drivers\bnad6.sys set SNMP_INSTALL_STATUS=0 set SNMP_INSTALL_STR= if /I "%snmp_install_op%"=="uninstall" set SNMP_INSTALL_STR=Uninstall if /I "%snmp_install_op%"=="install" set SNMP_INSTALL_STR=Install if /I "%snmp_install_op%"=="preinstall" set SNMP_INSTALL_STR=PreInstall if /I "%snmp_install_op%"=="chkprerequisite" set SNMP_INSTALL_STR=PreRequisiteCheck if /I "%snmp_install_op%"=="uninstall" set SNMP_INSTALL=false if /I "%SNMP_INSTALL%"=="false" goto _UNINSTALL if not EXIST brcd_snmp.dll ( ECHO. Cannot find brcd_snmp.dll. Check if the installation is correct. set SNMP_INSTALL_STATUS=2 goto _EXIT ) ECHO.Checking for bnad driver ... set bnad_status= for /f "tokens=3*" %%a in ('sc query bnad ^| findstr STATE') do set bnad_status=%%b if "%bnad_status%"=="" ( ECHO. ECHO.***Cannot find QLogic BR-series network drivers.*** ECHO.Please install QLogic BR-series network drivers and try again. set SNMP_INSTALL_STATUS=10 goto _EXIT ) ECHO.Checking the driver version ... echo Set oFSO = CreateObject("Scripting.FileSystemObject") >%vbs% echo WScript.Echo oFSO.GetFileVersion(WScript.Arguments.Item(0)) >>%vbs% for /f "tokens=*" %%a in ('cscript.exe /Nologo %vbs% %bnad%') do set filever=%%a del %vbs% set bnad_ver=%filever:~0,1% if "%bnad_ver%" lss "%min_bnad%" ( ECHO. bfa_installer.exe install_op=version driver_type=eth log_file_path=ver.log del ver.log>NUL ECHO.***Minimum supported driver version for SNMP is 3.0.0.0.*** ECHO.Please install appropriate QLogic BR-series network drivers and try again. set SNMP_INSTALL_STATUS=10 goto _EXIT ) ECHO.Checking for SNMP service ... set snmp_status= for /f "tokens=3*" %%a in ('sc query snmp ^| findstr STATE') do set snmp_status=%%b if "%snmp_status%"=="" ( ECHO. ECHO.***Cannot find SNMP service.*** ECHO.Please install SNMP service and try again. set SNMP_INSTALL_STATUS=10 goto _EXIT ) rem Done with Pre-Requisite check, go to end. if /I "%snmp_install_op%"=="CHKPREREQUISITE" goto _EXIT set restart_snmp=false ECHO.Checking for existing installation of QLogic BR-series SNMP subagent... tasklist /M brcd_snmp* | find "brcd_snmp">NUL if "%ERRORLEVEL%"=="0" ( rem An instance of brocade SNMP subagent is running. Stop the service. ECHO.Stopping snmp service... sc stop snmp>nul timeout /T 20 /nobreak> NUL set restart_snmp=true ) ECHO.Installing QLogic BR-series SNMP subagent... ECHO.Adding Registry Entries... regedit.exe /s /c brcd_snmp_add.reg ECHO.Copying QLogic BR-series subagent to %SystemRoot%\System32 ... copy brcd_snmp.dll %SystemRoot%\system32\. if "%ERRORLEVEL%" neq "0" ( set SNMP_INSTALL_STATUS=32 goto _EXIT ) if "%restart_snmp%" neq "true" goto _EXIT sc start snmp>nul ECHO.Waiting for subagent to be loaded... timeout /T 10 /nobreak> NUL tasklist /M brcd_snmp* | findstr "brcd_snmp">NUL if "%ERRORLEVEL%" neq "0" ( ECHO.The QLogic BR-series SNMP sub-agent is not loaded. Contact technical support. set SNMP_INSTALL_STATUS=1114 ) goto _EXIT :_UNINSTALL set restart_snmp=false ECHO.Checking for existing installation of QLogic BR-series SNMP subagent... tasklist /M brcd_snmp* | findstr "brcd_snmp">NUL if "%ERRORLEVEL%"=="0" ( set restart_snmp=true ) if /i "%restart_snmp%"=="true" ( sc stop snmp>nul timeout /T 10 /nobreak> NUL ) regedit.exe /s brcd_snmp_del.reg del %SystemRoot%\System32\brcd_snmp.dll if /i "%restart_snmp%"=="true" ( sc start snmp timeout /T 10 /nobreak> NUL ) :_EXIT ECHO. ECHO.***SNMPSubagent %SNMP_INSTALL_STR% Status: %SNMP_INSTALL_STATUS% net helpmsg %SNMP_INSTALL_STATUS% exit /b %ERRORLEVEL%