@echo off

set _OEMFILE=%1

find /i "CatalogFile = e2f.cat" C:\Windows\inf\%_OEMFILE%

if %errorlevel% == 0 (
    echo.%date% %time% Old LAN driver %_OEMFILE% was found and will uninstall it. >> %Windir%\Logs\LAN.log

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_15F2"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_15F3"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_0D9F"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_5502"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_5503"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_125B"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_125C"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_125D"



    Start /w %~dp0devcon.exe -f dp_delete %_OEMFILE%

    if %errorlevel% == 0 (
      echo.%date% %time% Old LAN driver %_OEMFILE% uninstall successfully. >> %Windir%\Logs\LAN.log
    ) else (
      echo.%date% %time% Old LAN driver %_OEMFILE% uninstall fail. >> %Windir%\Logs\LAN.log
    )
)

set _OEMFILE=%1

find /i "CatalogFile = e2fn.cat" C:\Windows\inf\%_OEMFILE%

if %errorlevel% == 0 (
    echo.%date% %time% Old LAN driver %_OEMFILE% was found and will uninstall it. >> %Windir%\Logs\LAN.log

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_15F2"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_15F3"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_0D9F"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_5502"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_5503"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_125B"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_125C"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_125D"



    Start /w %~dp0devcon.exe -f dp_delete %_OEMFILE%

    if %errorlevel% == 0 (
      echo.%date% %time% Old LAN driver %_OEMFILE% uninstall successfully. >> %Windir%\Logs\LAN.log
    ) else (
      echo.%date% %time% Old LAN driver %_OEMFILE% uninstall fail. >> %Windir%\Logs\LAN.log
    )
)

set _OEMFILE=%1

find /i "CatalogFile = e2f68.cat" C:\Windows\inf\%_OEMFILE%

if %errorlevel% == 0 (
    echo.%date% %time% Old LAN driver %_OEMFILE% was found and will uninstall it. >> %Windir%\Logs\LAN.log

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_15F2"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_15F3"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_0D9F"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_5502"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_5503"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_125B"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_125C"

    "%~dp0devcon.exe" remove "PCI\VEN_8086&DEV_125D"



    Start /w %~dp0devcon.exe -f dp_delete %_OEMFILE%

    if %errorlevel% == 0 (
      echo.%date% %time% Old LAN driver %_OEMFILE% uninstall successfully. >> %Windir%\Logs\LAN.log
    ) else (
      echo.%date% %time% Old LAN driver %_OEMFILE% uninstall fail. >> %Windir%\Logs\LAN.log
    )
)