Skip to content

Instantly share code, notes, and snippets.

@adiberr
Last active July 24, 2026 21:45
Show Gist options
  • Select an option

  • Save adiberr/be1ca883a94d4e32959bd8d1b821cfeb to your computer and use it in GitHub Desktop.

Select an option

Save adiberr/be1ca883a94d4e32959bd8d1b821cfeb to your computer and use it in GitHub Desktop.
Unattended Windows install from USB, HP driver pack goes in during setup. Boot straight to a working desktop.

Unattended Windows 11 + Drivers — HP EliteBook 840 G11

Boot USB, pick the disk, walk away. Drivers install during setup. One command after logon for HP apps and software.

Downloads

Prep the driver pack

Extract on any Windows PC:

sp168962.exe /s /e

Lands in C:\SWSETUP\sp168962\ZBEB_G11_MWSNB\W11_25H2\ — six folders: Audio, Chipset, Graphics, HSAs, Network, Other.

Optional prune. The pack covers six models; this drops ~2 GB of drivers for hardware the 840 G11 doesn't have, plus HP telemetry that installs itself via INF:

$root = 'C:\SWSETUP\sp168962\ZBEB_G11_MWSNB\W11_25H2'

$remove = @(
    'Graphics\Nvidia'            # ZBook only
    'Other\Fibocom'              # WWAN modem
    'Other\Wacom Technology'     # x360 digitizer
    'Other\HP\P018HB-B2G'        # TouchpointAnalytics
    'Other\HP\P018MC-B2T'        # HP OneAgent
    'Other\HP\P014X5-B2M'        # HP Services Scan
    'HSAs\NVIDIA_Video_Driver_and_Control_Panel_(P015T8-B2U)'
)

foreach ($item in $remove) {
    $path = Join-Path $root $item
    if (Test-Path -LiteralPath $path) {
        & attrib.exe -R -H -S "$path\*.*" /S /D 2>$null | Out-Null
        & cmd.exe /c rd /s /q "$path" 2>$null
        Write-Host "Removed $item" -ForegroundColor Green
    }
}

attrib + rd because HP marks files read-only and Remove-Item -Recurse -Force chokes on it in PS 5.1. Run elevated.

Do not remove Other\HP\P014UW-B2W — that's HpqKbFiltr.sys, the driver behind the Fn keys.

Build the USB

Burn the ISO with Rufus — GPT / UEFI / NTFS, label WIN11_INSTALL. Decline the Windows User Experience dialog; Rufus injects its own answer file and overrides yours.

After Rufus finishes, the USB holds only the ISO contents: boot, efi, sources, support. You add three things.

$WinPEDriver$ is not part of the ISO or the driver pack — you create it. The name is what Windows Setup looks for. Use single quotes in PowerShell or the $ is read as a variable:

New-Item -Path 'E:\$WinPEDriver$' -ItemType Directory

Copy the contents of W11_25H2 into it — the six folders, not the W11_25H2 folder itself:

Copy-Item -Path 'C:\SWSETUP\sp168962\ZBEB_G11_MWSNB\W11_25H2\*' `
          -Destination 'E:\$WinPEDriver$\' -Recurse

Then drop autounattend.xml and workstation.ps1 at the USB root.

Final layout:

WIN11_INSTALL (root)
├── boot\  efi\  sources\  support\    <- from Rufus, leave alone
├── autounattend.xml
├── workstation.ps1
└── $WinPEDriver$\
    ├── Audio\    Chipset\   Graphics\
    ├── HSAs\     Network\   Other\

Verify before booting:

Get-ChildItem E:\ | Select-Object Name
(Get-ChildItem 'E:\$WinPEDriver$' -Recurse -File).Count

Root must list $WinPEDriver$ spelled exactly — if it shows WinPEDriver or blank, the $ was interpreted; delete and redo it in Explorer. File count is 1,744 pruned, 2,520 unpruned.

How it works

Windows Setup scans $WinPEDriver$ during the PE stage and installs INFs that match by hardware ID. Irrelevant drivers never bind. No script, no pnputil.

autounattend.xml handles accounts, locale, debloat and autologon. Disk selection stays interactive, so nothing can wipe the wrong drive.

After logon

One command, elevated PowerShell:

& 'E:\workstation.ps1'

Runs HP's InstallAllApps.cmd (hotkeys, vendor control panels) then the winget list. Finds the HSA installer recursively from its own location, so only that first drive letter matters. Reboot when done.

Verify

Get-PnpDevice -PresentOnly | Where-Object { $_.Problem -ne 0 }
Select-String C:\Windows\Panther\setupact.log -Pattern 'unattend','\$WinPEDriver\$','PnPIBS'
winget --info

First returns nothing. Second proves the answer file was selected and the driver folder was found.

Notes

  • Set the real SSID and passphrase in the generator's Wi-Fi section. A placeholder means no network, which means winget installs nothing.
  • HSA log lands at <script drive>:\ProgramData\HP\logs\UWP\_InstallAllApps.log.
  • autounattend.xml holds the account password in plaintext. Keep the USB private.
  • No BIOS or firmware updates in the pack. Run HP Image Assistant occasionally for those.
  • To stop Windows Update replacing HP's validated drivers, add a .reg as a System script in the generator: HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdateExcludeWUDriversInQualityUpdate=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment