The Deployment Bunny

OS Deployment, Virtualization, Microsoft based Infrastructure…

  • Archives

  • Meta

PowerShell is King – Export drivers from Windows

Posted by Mikael Nystrom on February 26, 2016

During the OSD Deployment class this week we talked about drivers, one question was “is it possible to cheat?” and the answer is “Yes”

If you have a Windows 8.1/Windows Server 2012 R2 (or later) you can take the new PC, boot it and extract the drivers using PowerShell and then import them in MDT, ConfigMgr to deploy them, or use PNPUtil.exe to inject them.

How to export drivers

Export-WindowsDriver -Destination "C:\Drivers\$((Get-WmiObject -Class win32_computersystem).Model)" -Online

This command will create the folder c:\Drivers\”ModelName” and export all drivers from the running OS into that folder, like this:


Should I remove anything before import?

Yes, usually you don’t want the printer drivers, so you can remove the folders that starts with prn…. Those are printer drivers, like OneNote and similar…

What about import?

If you need to import them you can either use forfiles.exe plus pnputil.exe

or you can of course use PowerShell…

$infs = Get-ChildItem -Path "C:\Drivers\$((Get-WmiObject -Class win32_computersystem).Model)" -Filter "*.inf" -Recurse -File
foreach($inf in $infs){
    pnputil.exe -i -a ""$inf.FullName""




8 Responses to “PowerShell is King – Export drivers from Windows”

  1. Pierre said

    Reblogged this on IT Operations Tech and commented:
    Fantastiskt inlägg från Nyström om att exportera drivrutiner och sedan importera in dem i en deploymentlösning (MDT/ConfigMgr).

  2. […] more details here: […]

  3. weiixing said

    PS C:\Users\Administrator> Export-WindowsDriver -Destination “C:\drivers1\$((Get-WmiObject -Class win64_computersys
    Model)” -Online
    无法将“Export-WindowsDriver”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请
    所在位置 行:1 字符: 21
    + Export-WindowsDriver <<<


  4. […] i found a cool article about exporting driver with powershell: powershell-is-king-export-drivers-from-windows/ […]

  5. Marcos said

    For drivers, I like to use this tool:

    It is nice because it will show you only non-Microsoft/standard drivers on the system. Then you can use your usual methods for importing to MDT/SCCM.

    • Well, the function does export only non-built-in Microsoft drivers, so it does the same thing actually, you can import the drivers exported this way in the same way into ConfigMgr/MDT

  6. […] Use Mikael Nystrom’s PowerShell is King – Export drivers from Windows good stuff if you have a box already configured how you want and it’s not Windows […]

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: