@ECHO OFF

if not "%9" =="" goto lanupdate

echo we will install IMB driver for you.
GOTO :install_imb_driver


:install_imb_driver
ver | find "2000" > nul
if %ERRORLEVEL% == 0 goto ver_2000

ver | find "XP" > nul
if %ERRORLEVEL% == 0 goto ver_xp

systeminfo | find "2003"> nul
if %ERRORLEVEL% == 0 goto ver_2003

systeminfo | find "2008"> nul
if %ERRORLEVEL% == 0 goto ver_2008

echo Machine undetermined.
goto exit

:ver_2000
echo OS version:Windows Server 2000
call IMB_Driver\Windows2003_2000\Release\ia32\SetupIMB.exe
goto exit

:ver_2003
systeminfo | find "x64"> nul
if %ERRORLEVEL% == 0 goto ver_2003_64
goto ver_2003_32

:ver_2008
systeminfo | find "x64"> nul
if %ERRORLEVEL% == 0 goto ver_2008_64
goto ver_2008_32

:ver_xp
systeminfo | find "x64"> nul
if %ERRORLEVEL% == 0 goto ver_xp_64
goto ver_xp_32

:ver_xp_64
:Run Windows XP-specific commands here.
echo OS version:Windows x64 XP
call IMB_Driver\WindowsXP\Release\x64\SetupIMB.exe
goto exit

:ver_xp_32
:Run Windows XP-specific commands here.
echo OS version:Windows XP
call IMB_Driver\WindowsXP\Release\ia32\SetupIMB.exe
goto exit

:ver_2003_64
:Run Windows XP-specific commands here.
echo OS version:Windows x64 Server 2003
call IMB_Driver\Windows2003_2000\Release\x64\SetupIMB.exe
goto exit

:ver_2003_32
:Run Windows XP-specific commands here.
echo OS version:Windows Server 2003
call IMB_Driver\Windows2003_2000\Release\ia32\SetupIMB.exe
goto exit

:ver_2008_64
:Run Windows XP-specific commands here.
echo OS version:Windows x64 Server 2008
call IMB_Driver\Windows2003_2000\Release\x64\SetupIMB.exe
goto exit

:ver_2008_32
:Run Windows XP-specific commands here.
echo OS version:Windows Server 2008
call IMB_Driver\Windows2003_2000\Release\ia32\SetupIMB.exe
goto exit

:exit
net stop "Supero SD3Service Daemon"
net stop "SuperMicro Health Assistant"
wUpdate.exe %*
net start "SuperMicro Health Assistant"
net start "Supero SD3Service Daemon"
goto update_complete

:lanupdate
wUpdate.exe %*
goto update_complete

:update_complete
