Forum Discussion

Mousefluff's avatar
Mousefluff
Iron Contributor
Jul 20, 2024

Example: Use WinPE To Remove A Non-Functional Driver From An Offline 10 / 11 Image

REM List All 3rd-Party Drivers on an Offline Windows 10/11 Image
IF NOT EXIST "C:\Scrtch" MKDIR "C:\Scrtch"
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Get-WindowsDriver -Path C:\ -ScratchDirectory C:\Scrtch | Sort ProviderName | Format-Table Driver,ProviderName,ClassName,BootCritical,OriginalFileName -AutoSize | Out-String -Stream -Width 32767}"
RMDIR /S /Q "C:\Scrtch"

REM Create a UTF-8 Text File That Lists All 3rd-Party Drivers on an Offline Windows 10/11 Image
IF NOT EXIST "C:\Scrtch" MKDIR "C:\Scrtch"
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Set-Content -Path 'C:\Driver_List.txt' -value (Get-WindowsDriver -Path C:\ -ScratchDirectory C:\Scrtch | Sort ProviderName | Format-Table Driver,ProviderName,ClassName,BootCritical,OriginalFileName -AutoSize | Out-String -Stream -Width 32767)}"
RMDIR /S /Q "C:\Scrtch"

REM Remove a Driver from an Offline Windows 10/11 Image
IF NOT EXIST "C:\Scrtch" MKDIR "C:\Scrtch"
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& {Remove-WindowsDriver -Driver oem<NUMBER>.inf -Path C:\ -ScratchDirectory C:\Scrtch}"
RMDIR /S /Q "C:\Scrtch"

2 Replies

  • Kiantor's avatar
    Kiantor
    Brass Contributor
    A Windows Preinstallation Environment (WinPE) is a lightweight version of Windows that can be used to troubleshoot and repair systems. You can create a WinPE media using Microsoft's Media Creation Tool or by using a third-party tool like Rufus.
  • Eommy's avatar
    Eommy
    Iron Contributor
    WinPE environment: You will need a WinPE boot media with appropriate drivers and tools.

    Mount Windows Image: Use the appropriate tools to mount your Windows image file.

    List Drivers: Use a PowerShell script or other method to list all drivers in the image.

    Identify Drivers to Remove: Identify non-functional drivers to remove based on the driver name or date.

    Remove Driver: Use the appropriate command or tool option to remove the specified driver.

    Verify and Uninstall Image: After removing a driver, ensure that it has been removed from the image and then uninstall the image.

    Reboot and Test: Deploy the modified image to your system and reboot to test if the driver removal was successful.

Resources