@echo System restart is required after uninstallation
@pause


@set LOGFILE=%temp%\OFUuninstall.Log
@echo %time%:Starting the UnInstallation of Online Flash Update Utility >> %LOGFILE%
@set PLTFRM=%1 
if %PLTFRM%==1 goto start
if %PLTFRM%==2 goto start
:usage
@echo.
@echo USAGE: uninstall [ID]
@echo The ID is the  number specifying whether the system has BMC or not.
@echo ID = 1 indicates the system has BMC.
@echo ID = 2 indicates the system does not have BMC.
@echo.
@echo Example:
@echo.
@echo         Install 1
@echo.
@goto exit

:start
@echo.
@echo Uninstalling the drivers...
@echo %time%:Uninstalling the drivers >> %LOGFILE%
@echo.
if "%OFUOSVERSION%"=="2K0" goto done
@echo.
@echo %time%:Uninstalling the drivers >> %LOGFILE%
@echo.
DeviceSetup.exe -v remove *INT0800 >> %LOGFILE% 2>&1 >NUL
@if %ERRORLEVEL% GEQ 0 goto imbuninstall
@echo %time%:UnInstallation of driver failed >> %LOGFILE%
@goto error
q
:imbuninstall
if %PLTFRM%==2 goto ibsmuninstall
@echo.
@echo %time%:UnInstalling IMB driver >> %LOGFILE%
@echo.
DeviceSetup.exe -v remove *IMBDRV >> %LOGFILE% 2>&1 >NUL
goto ibsmuninstall
@echo %time%:UnInstallation of IMB driver Failed >> %LOGFILE%
goto error

:ibsmuninstall
if "%OFUOSVERSION%"=="2K0" goto done
@echo.
@echo %time%:Uninstalling the drivers >> %LOGFILE%
@echo.
DeviceSetup.exe -v remove *IntelUtilDeV >> %LOGFILE% 2>&1 >NUL
@goto done
@if %ERRORLEVEL% GEQ 0 goto done
@echo %time%:UnInstallation of driver failed >> %LOGFILE%
@goto error

:done
REGEDIT /S OFU.reg
rmdir /s /q enus 
del /q *.* 2>NUL
@echo Done!
@echo.
@echo %time%:Successfully Uninstalled the Online Flash Update Utility drivers >> %LOGFILE%
@echo *********************************************************************** >> %LOGFILE%
@echo Successfully Uninstalled the Online Flash Update Utility !
@echo PLEASE REBOOT the system for changes to take effect.
@goto exit

:error
@echo.
@echo %time%:Error Uninstalling the Online Flash Update Utility drivers >> %LOGFILE%
@echo ***************************************************************** >> %LOGFILE%
@echo @@@@ Error Uninstalling the Online Flash Update Utility drivers @@@@
@echo.

:exit


