Partager via


Grabbing out-of-box drivers from a Windows 8 system

It seems like a common request:  I’ve got a brand new system, right out of the box from the OEM.  It has all the drivers on it that are needed.  So rather than find and download those same drivers from the OEM’s website, why can’t I just extract the drivers from OS that’s already on the system?

Well, you can – with some caveats described below.  I’ve never been a big fan of this approach due to those caveats, but it can work well in some scenarios.  It’s a little scary that people will download random utilities from random websites to do this though, especially when it’s so easy to do on Windows 8 and above using PowerShell.

So attached to this blog is a script for doing just that.  It’s really quite simple, as it leverages the “Get-WindowsDriver” PowerShell cmdlet to get the list of out-of-box drivers (which is what the cmdlet does by default).  The meat of it:

Get-WindowsDriver -online | % {
   $dir = Split-Path $_.OriginalFileName -Parent ;
   $subdir = Split-Path $dir -Leaf ;
   $driverDest = "$destination\$subdir";
   Write-Host "Copying $dir to $driverDest\$subdir" ;
   Copy-Item -Path $dir -Destination $driverDest -Recurse
}

(Don’t try to copy and paste this, unless you set the $destination variable manually.  The attached script is set up as a cmdlet and will prompt for that destination path, which should already exist.  The attached script also includes the required disclaimer that says this isn’t supported by Microsoft in any way.)

The logic is fairly simple:

  • For each out-of-box driver, get the original file name, which is the full path to the INF file in the driver repository folder, e.g. C:\Windows\System32\DriverStore\FileRepository\driverFolder\driver.inf. 
  • Chop the file name off of that to get the folder path, e.g. C:\Windows\System32\DriverStore\FileRepository\driverFolder. 
  • Chop the folder name from that path to use in the destination, e.g. driverFolder.
  • Copy from source to destination.

That’s it.  Give it a few minutes to run (the Get-WindowsDriver cmdlet will take a little while to execute as it sifts through all the drivers), then look at the destination folder you specified to see all the drivers.

Now for the caveats:

  • This assumes that all the files required for the driver and/or device are present in the driver folder.  While the core driver files should be there, any applets, control panels, shell extensions, etc. might not be.  So you might need to install the full OEM package to get complete functionality.  In some cases, the driver may not even work without this (e.g. Bluetooth, mobile broadband).
  • You might get more drivers than you really need.  For example, my laptop has over 100 out-of-box drivers.  Does it really need 100 drivers to work?  No, it only needs 6-7.  Some are older versions, some are for various USB devices that I’ve attached in the last year (printers, cameras, headsets, DisplayPort docks, etc.), some I have no idea where they came from.  So the cleaner the system is, the better.
  • You will probably get old versions.  The images that OEMs ship on new machines aren’t always kept up to date, so you might find that those original drivers have “issues” – some will get updated immediately from Windows Update, others will require updating from the OEM’s website anyway.  (I would definitely check for the latest video and network drivers regardless.)

Good luck.

GetMyDrivers.ps1

Comments

  • Anonymous
    October 18, 2013
    Hi Michael the day yesterday in powershell script implemented by changing to a valid path, the process framework not only mistake that the entire list of drivers I copied only 4 elements, of the many that exist in the FileRepository folder ... to think that this process is due? greetings from Aguascalientes Mexico Octavio blogs.itpro.es/octaviordz

  • Anonymous
    October 18, 2013
    ok I get it to all drivers only deals with extracting those that are really needed to make use of them, anyway thank you very much for the script Michael greetings .... everything went to perfection :)

  • Anonymous
    November 04, 2013
    Hi Michael,does this sound feasible? Using MDT2013 to create 8.1 images then copying them to SCCM 2007 for distribution?

  • Anonymous
    November 05, 2013
    Here is my take on this :) blogs.msdn.com/.../harvesting-drivers-from-running-computer.aspx

  • Anonymous
    January 09, 2014
    Pingback from MS Surface RT School Deployment

  • Anonymous
    May 11, 2014
    The comment has been removed

  • Anonymous
    May 12, 2014
    Pingback from Material de apoyo usado en la preconferencia de TechED NA 2014 (deployment??s) + links de interes – Freelance-IT Ags, Mex.

  • Anonymous
    May 13, 2014
    The comment has been removed

  • Anonymous
    July 31, 2015
    thank you very much. im having hard time with my intel wireless n2230 it keeps dropping connection. only stable driver comes from windows update on win8.1 that way ill move that driver to windows10

  • Anonymous
    September 01, 2015
    Inspired by Michael's blog post on grabbing drivers from running computer from here:http://blogs.technet

  • Anonymous
    February 24, 2016
    Code I used to put the drivers here on my machine: C:testingDriverBackup

    Get-WindowsDriver -online | % {
    $dir = Split-Path $_.OriginalFileName -Parent ;
    $subdir = Split-Path $dir -Leaf ;
    $driverDest = "C:testingDriverBackup$destination$subdir";
    Write-Host "Copying $dir to $driverDest$subdir" ;
    Copy-Item -Path $dir -Destination $driverDest -Recurse
    }