Hi all.
Despite the rumors to the contrary, I am very much alive and well. I just checked the site logs and it looks like my last post here was nearly 10 years ago (yikes!). I spent a few years working for LinMin building a bare-metal deployment toolkit for them (which is sadly VERY closed-source by NDA). The source code for this was more than 3000 lines of code and incorporated code obfuscation and piracy countermeasures...I'm pretty proud of it, but nobody will ever see it.
I poked my head in here to see if anyone had done any scripting work on getting drivers loaded into Windows 11. We've taken delivery of several hundred Dell laptops at work, and the USAF Win11 SDC (standard desktop configuration) image doesn't have any drivers included for this hardware. I spoke with one of our IT members and they've been struggling to load all of these drivers manually (and individually)...what dumbasses! Several years ago I wrote a script to take the SDC image apart, inject drivers for mass-storage, and include a $OEM$ folder containing a universal driver deployment folder before repacking the image for deployment. Apparently, they're not allowed to do that anymore, so my prior work goes unused.
Anyway, they're pulling this old fart out of retirement so to speak (this is not part of my daily job) to build a PowerShell scripting tool to help them automate the driver updating process. This needs to be done in-house and without the use of external utilities (like SDI or 7zip) and rely purely on applets included within the OS.
The core function of updating drivers on running Win10/Win11 is provided by the included utility of PNPUtil.exe which can be expressed simply with the command:
Get-ChildItem "C:\mydrivers\" -Recurse -Filter "*.inf" |
ForEach-Object { PNPUtil.exe /add-driver $_.FullName /install }
Here's more info on some of the modularity available with powershell. https://hudson.tel/post/mass-driver-ins … nd-intune/
I might post my results here once I'm done with a proof-of-concept.
If anyone has ideas to help me along, I'm all ears. I'm at day-1.
*Edit
The below code seems to run just fine. It has basic logging and is launched by a "helper" install.bat.
Install.bat
SET WorkingDir=%cd%
SET PSPath='%WorkingDir%\Install-SpecifiedDrivers.ps1'
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& %PSPath%"
Install-SpecifiedDrivers.ps1
# Install any drivers specified in the .\drivers directory using pnputil.exe
$TempLogs = "$env:HOMEDRIVE\Temp\Logs\Install-SpecifiedDrivers_LOG.txt"
$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
Start-Transcript -Path $TempLogs
Get-ChildItem "$PSScriptRoot\drivers\" -Recurse -Filter "*.inf" |
ForEach-Object {
$DriverFullName = $_.FullName
pnputil.exe /add-driver $DriverFullName /install
Write-Host "Driver: $DriverFullName"
}
Stop-Transcript
Works by scanning the /drivers/ subfolders for any .inf files and then using pnputil to install that driver and move on to the next. It will not upgrade existing installed drivers (I need to tinker with the "enumerate" command for that). It also does not run from a optical drive (CD/DVD). It's simple, and it works.