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
https://deploymentbunny.com/2011/05/07/adding-drivers-using-pnputil-and-forfiles/
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){
$inf.FullName
pnputil.exe -i -a ""$inf.FullName""
}
/mike
Categories: Drivers, PowerShell
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).
PS C:\Users\Administrator> Export-WindowsDriver -Destination “C:\drivers1\$((Get-WmiObject -Class win64_computersys
Model)” -Online
无法将“Export-WindowsDriver”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请
路径正确,然后重试。
所在位置 行:1 字符: 21
+ Export-WindowsDriver <<<
???
Change -Destination to C:\Drivers\Unknown
For drivers, I like to use this tool: https://gallery.technet.microsoft.com/ConfigMgr-Driver-Injector-aae7d17d
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