@echo off
cls
REM ******************************************************************************
REM Copyright (c) 2009, Intel Corporation.
REM This System Configuration Utility is furnished under license and may only be 
REM used or copied in accordance with the terms of that license. No license, express 
REM or implied, by estoppel or otherwise, to any intellectual property rights is 
REM granted by this document. The Software is subject to change without notice, and 
REM should not be construed as a commitment by Intel Corporation to market, 
REM license, sell or support any product or technology. Unless otherwise provided for 
REM in the license under which this Software is provided, the Software is provided AS 
REM IS, with no warranties of any kind, express or implied. Except as expressly 
REM permitted by the Software license, neither Intel Corporation nor its suppliers 
REM assumes any responsibility or liability for any errors or inaccuracies that may 
REM appear herein. Except as expressly permitted by the Software license, no part of
REM the Software may be reproduced, stored in a retrieval system, transmitted in any 
REM form, or distributed by any means without the express written consent of Intel 
REM Corporation.
REM ******************************************************************************
@echo.
@set FLASH_DRV_INF=flashud.inf
@set IMB_DRV_INF=imbdrv.inf
@set IBS_UTIL_INF=IBSMUx64.inf
@set CURDIR=%cd%
@set DEST_DIR=CURDIR

Reg query HKEY_LOCAL_MACHINE\HARDWARE\ACPI\RSDT\INTEL_ > r.txt 2>&1
find "S3420GPV" r.txt >NUL 2>&1
if errorlevel 1 goto bmcless > NUL 2>&1
goto installflashdrv

:bmcless
Reg query HKEY_LOCAL_MACHINE\HARDWARE\ACPI\RSDT\INTEL_ > r.txt 2>&1
find "S3000" r.txt >NUL 2>&1
if errorlevel 1 goto installimbdrv > NUL 2>&1
goto installflashdrv


:installimbdrv
echo "Installing IMB Driver"
devicesetup updateonly imbdrv.inf *IMBDRV >NUL 1>&2
if errorlevel 0 echo "IMBDriver upgraded successfully"  && goto exit
wmic /NAMESPACE:\\root\wmi class Microsoft_IPMI >ms.txt 2>&1
find "No Instance(s) Available." ms.txt >NUL
if errorlevel 1 echo "MSIPMI Driver detected. Skipping IMBDRV installation" && goto exit
devicesetup install imbdrv.inf *IMBDRV
if errorlevel 0 echo "IMBDriver Installed Successfully" && goto exit
echo "Installation of IMBDRV failed"


:exit
if exist ms.txt del ms.txt > NUL 2>&1


:installflashdrv
del r.txt > NUL
@echo Installing SMI Driver...
DeviceSetup.exe install %FLASH_DRV_INF% *INT0800

@echo "Installing Memory Mapped Driver..."
devicesetup updateonly IBSMUx64.inf *IntelUtilDeV >NUL 1>&2
if errorlevel 0 echo "Memory Mapped Driver upgraded successfully"  && goto exit
DeviceSetup.exe install IBSMUx64.inf *IntelUtilDeV

:exit
if exist ms.txt del ms.txt > NUL 2>&1

@echo Done!











