Skip to content

Commit 2ef7f2d

Browse files
initial driver support
1 parent cca9bee commit 2ef7f2d

File tree

2 files changed

+63
-8
lines changed

2 files changed

+63
-8
lines changed

functions/private/Invoke-WinUtilISOScript.ps1

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ function Invoke-WinUtilISOScript {
55
66
.DESCRIPTION
77
Removes AppX bloatware and OneDrive, injects hardware drivers (NVMe, Precision
8-
Touchpad/HID, and network) exported from the running system, applies offline
9-
registry tweaks (hardware bypass, privacy, OOBE, telemetry, update suppression),
10-
deletes CEIP/WU scheduled-task definition files, and optionally drops
11-
autounattend.xml and removes the support\ folder from the ISO contents directory.
8+
Touchpad/HID, and network) exported from the running system, optionally injects
9+
extended Storage & Network drivers from the ChrisTitusTech/storage-lan-drivers
10+
repository (requires git, installed via winget if absent), applies offline registry
11+
tweaks (hardware bypass, privacy, OOBE, telemetry, update suppression), deletes
12+
CEIP/WU scheduled-task definition files, and optionally drops autounattend.xml and
13+
removes the support\ folder from the ISO contents directory.
1214
Mounting/dismounting the WIM is the caller's responsibility (e.g. Invoke-WinUtilISO).
1315
1416
.PARAMETER ScratchDir
@@ -44,7 +46,7 @@ function Invoke-WinUtilISOScript {
4446
.NOTES
4547
Author : Chris Titus @christitustech
4648
GitHub : https://github.com/ChrisTitusTech
47-
Version : 26.02.25
49+
Version : 26.02.25b
4850
#>
4951
param (
5052
[Parameter(Mandatory)][string]$ScratchDir,
@@ -177,13 +179,64 @@ function Invoke-WinUtilISOScript {
177179
}
178180
}
179181

180-
& $Log "Driver injection complete $injected driver package(s) added."
182+
& $Log "Driver injection complete - $injected driver package(s) added."
181183
} catch {
182184
& $Log "Error during driver export/injection: $_"
183185
} finally {
184186
Remove-Item -Path $driverExportRoot -Recurse -Force -ErrorAction SilentlyContinue
185187
}
186188

189+
# ── 2b. Optional: extended Storage & Network drivers from community repo ──
190+
$extDriverChoice = [System.Windows.MessageBox]::Show(
191+
"Would you like to inject extended Storage and Network drivers?`n`n" +
192+
"This clones github.com/ChrisTitusTech/storage-lan-drivers and injects all " +
193+
"drivers from that repository into the image.`n`n" +
194+
"Git will be installed via winget if it is not already present.",
195+
"Extended Drivers", "YesNo", "Question")
196+
197+
if ($extDriverChoice -eq 'Yes') {
198+
& $Log "Extended driver injection requested."
199+
200+
# Ensure git is available
201+
$gitCmd = Get-Command git -ErrorAction SilentlyContinue
202+
if (-not $gitCmd) {
203+
& $Log "Git not found — installing via winget..."
204+
winget install --id Git.Git -e --source winget `
205+
--accept-package-agreements --accept-source-agreements | Out-Null
206+
# Refresh PATH so git is visible in this session
207+
$env:PATH = [System.Environment]::GetEnvironmentVariable('PATH', 'Machine') + ';' +
208+
[System.Environment]::GetEnvironmentVariable('PATH', 'User')
209+
$gitCmd = Get-Command git -ErrorAction SilentlyContinue
210+
}
211+
212+
if (-not $gitCmd) {
213+
& $Log "Warning: git could not be found after install attempt — skipping extended drivers."
214+
} else {
215+
$extRepoDir = Join-Path $env:TEMP "WinUtil_ExtDrivers_$(Get-Random)"
216+
try {
217+
& $Log "Cloning storage-lan-drivers repository..."
218+
& git clone --depth 1 `
219+
"https://github.com/ChrisTitusTech/storage-lan-drivers" `
220+
$extRepoDir 2>&1 | ForEach-Object { & $Log " git: $_" }
221+
222+
if (Test-Path $extRepoDir) {
223+
& $Log "Injecting extended drivers into image (this may take several minutes)..."
224+
& dism /English "/image:$ScratchDir" /Add-Driver "/Driver:$extRepoDir" /Recurse 2>&1 |
225+
ForEach-Object { & $Log " dism: $_" }
226+
& $Log "Extended driver injection complete."
227+
} else {
228+
& $Log "Warning: repository clone directory not found — skipping extended drivers."
229+
}
230+
} catch {
231+
& $Log "Error during extended driver injection: $_"
232+
} finally {
233+
Remove-Item -Path $extRepoDir -Recurse -Force -ErrorAction SilentlyContinue
234+
}
235+
}
236+
} else {
237+
& $Log "Extended driver injection skipped."
238+
}
239+
187240
# ═════════════════════════════════════════════════════════════════════════
188241
# 3. Remove OneDrive
189242
# ═════════════════════════════════════════════════════════════════════════

functions/private/Invoke-WinUtilISOUSB.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,14 @@ exit
141141
# ── Phase 3: Create partitions via diskpart ──────────────────────────
142142
# "create partition efi" is not supported on removable media.
143143
# A single FAT32 primary partition is all that is needed for a UEFI-
144-
# bootable Windows install USB the firmware locates \EFI\Boot\bootx64.efi
144+
# bootable Windows install USB - the firmware locates \EFI\Boot\bootx64.efi
145145
# on any FAT32 volume regardless of GPT partition type.
146+
# FAT32 label limit is 11 chars; "W11-yyMMdd" = 10, fits without trimming.
147+
$volLabel = "W11-" + (Get-Date).ToString('yyMMdd')
146148
$dpScript2 = @"
147149
select disk $diskNum
148150
create partition primary
149-
format quick fs=fat32 label="WINPE"
151+
format quick fs=fat32 label="$volLabel"
150152
exit
151153
"@
152154
$dpFile2 = Join-Path $env:TEMP "winutil_diskpart2_$(Get-Random).txt"

0 commit comments

Comments
 (0)