# Fix Fastboot Driver - Remove broken Zadig driver and reinstall properly # Run as Administrator! Write-Host "=== Fix Fastboot USB Driver ===" -ForegroundColor Cyan Write-Host "" # Check if running as admin $isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) if (-not $isAdmin) { Write-Host "ERROR: Must run as Administrator!" -ForegroundColor Red Write-Host "Right-click PowerShell -> Run as Administrator" -ForegroundColor Yellow exit 1 } # Step 1: Remove the broken Zadig-installed driver for fastboot Write-Host "Step 1: Removing broken fastboot driver..." -ForegroundColor Yellow # Find and remove the Android Bootloader Interface device $devices = Get-PnpDevice | Where-Object { $_.InstanceId -like '*VID_18D1*PID_4EE0*' } foreach ($dev in $devices) { Write-Host " Found: $($dev.FriendlyName) [$($dev.InstanceId)]" -ForegroundColor Gray Write-Host " Removing device entry..." -ForegroundColor Yellow pnputil /remove-device "$($dev.InstanceId)" 2>&1 } # Also try removing by hardware ID Write-Host "" Write-Host "Step 2: Removing Zadig OEM driver packages..." -ForegroundColor Yellow $drivers = pnputil /enum-drivers 2>&1 | Out-String Write-Host " Scanning installed driver packages..." # List all OEM drivers and check for our device $oems = pnputil /enum-drivers 2>&1 $currentOem = "" $isTarget = $false foreach ($line in $oems) { if ($line -match "Published Name\s*:\s*(oem\d+\.inf)") { $currentOem = $Matches[1] $isTarget = $false } if ($line -match "18D1" -or $line -match "0E8D" -or $line -match "AndroidUsbDeviceClass" -or $line -match "Android Bootloader" -or $line -match "MT65xx") { $isTarget = $true } if ($line -match "^\s*$" -and $isTarget -and $currentOem) { Write-Host " Removing driver package: $currentOem" -ForegroundColor Red pnputil /delete-driver $currentOem /force 2>&1 $isTarget = $false $currentOem = "" } } # Step 3: Install Google USB Driver for fastboot Write-Host "" Write-Host "Step 3: Installing Google USB Driver..." -ForegroundColor Yellow $googleDriver = "C:\Users\PCOEM\platform-tools\..\usb_driver\android_winusb.inf" $googleDriver2 = "C:\Users\PCOEM\usb_driver\Android.inf" if (Test-Path "C:\Users\PCOEM\platform-tools\usb_driver\android_winusb.inf") { Write-Host " Using Google USB Driver from platform-tools" -ForegroundColor Green pnputil /add-driver "C:\Users\PCOEM\platform-tools\usb_driver\android_winusb.inf" /install 2>&1 } elseif (Test-Path $googleDriver2) { Write-Host " Using USB driver from C:\Users\PCOEM\usb_driver" -ForegroundColor Green pnputil /add-driver $googleDriver2 /install 2>&1 } else { Write-Host " No Google USB driver found. Will need to install manually." -ForegroundColor Yellow Write-Host " Download from: https://developer.android.com/studio/run/win-usb" -ForegroundColor Gray } Write-Host "" Write-Host "Step 4: Scanning for hardware changes..." -ForegroundColor Yellow pnputil /scan-devices 2>&1 Write-Host "" Write-Host "=== Done! ===" -ForegroundColor Green Write-Host "Now reboot the tablet to fastboot and try 'fastboot devices'" -ForegroundColor Cyan