2-download And Install Usbdk-1.0.22-x64.msi -

// Check Windows registry string uninstallKey = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"; using (Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(uninstallKey)) if (key != null) foreach (string subkeyName in key.GetSubKeyNames()) using (Microsoft.Win32.RegistryKey subkey = key.OpenSubKey(subkeyName)) if (subkey?.GetValue("DisplayName")?.ToString()?.Contains("UsbDk") == true) return true; return false; catch return false;

} using System; namespace USBDriverInstaller 2-download and install usbdk-1.0.22-x64.msi

// Step 3: Download the installer _logger.LogInfo($"Downloading USBDK from USBDK_DOWNLOAD_URL"); if (!await DownloadInstallerAsync()) _logger.LogError("Failed to download USBDK installer"); return false; catch return false

public void LogError(string message) Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine($"[ERROR] DateTime.Now:HH:mm:ss - message"); Console.ResetColor(); } using System

return ($null -ne $usbdkEntry) function Download-USBDKInstaller Write-Log "INFO" "Downloading USBDK from $USBDK_URL"

catch Write-Log "ERROR" "Installation error: $($_.Exception.Message)" return $false