private/Get-OSDeployCoreWinPEDrivers.ps1
|
#Requires -PSEdition Core #Requires -Version 7.4 function Get-OSDeployCoreWinPEDrivers { <# .SYNOPSIS Gets shared WinPE driver directories from OSDeployCore Boot-Assets .DESCRIPTION Displays the OSDeploy banner and enumerates immediate child directories beneath the Boot-Assets winpedrivers-amd64 and winpedrivers-arm64 paths. Results are sorted by name and full path. Optional filters can limit architecture, remove wireless driver directories, or display an Out-GridView selector. .PARAMETER Architecture Limits discovery to amd64 or arm64. When omitted, both architecture directories are searched. .PARAMETER SkipWifiDrivers Excludes directories whose names contain wifi or wireless, case-insensitively. .PARAMETER Interactive Displays discovered directories in Out-GridView and returns only selected rows as directory objects. Canceling the picker returns no driver directories. .EXAMPLE PS> Get-OSDeployCoreWinPEDrivers -Architecture 'amd64' -SkipWifiDrivers Returns amd64 driver directories except those with wifi or wireless in their names. .INPUTS None. This function does not accept pipeline input. .OUTPUTS System.IO.DirectoryInfo. Returns zero or more discovered driver directories, or the directories selected through Out-GridView when Interactive is specified. .NOTES Author: David Segura Company: Recast Software Version: 0.1.0 Date: 2026-08-28 Dependencies: Module Functions: Write-HostOSDeployBanner Commands: Out-GridView when Interactive is specified DotNet Classes: System.Collections.Generic.List[System.Management.Automation.PSCustomObject], System.IO.DirectoryInfo #> [CmdletBinding()] [OutputType([System.IO.DirectoryInfo])] param ( [Parameter()] [ValidateSet('amd64', 'arm64')] [System.String]$Architecture, [Parameter()] [switch]$SkipWifiDrivers, [Parameter()] [switch]$Interactive ) begin { Write-HostOSDeployBanner } process { $architectures = if ($Architecture) { @($Architecture) } else { @('amd64', 'arm64') } $driverItems = [System.Collections.Generic.List[PSCustomObject]]::new() foreach ($arch in $architectures) { $driverPath = Join-Path $script:OSDeployBootAssetsPath "winpedrivers-$arch" if (Test-Path -Path $driverPath -PathType Container) { Get-ChildItem -Path $driverPath -Directory | ForEach-Object { $driverItems.Add([PSCustomObject]@{ Type = 'winpe-driver' Name = $_.Name Architecture = $arch FullName = $_.FullName LastWriteTime = $_.LastWriteTime }) } } } if ($SkipWifiDrivers) { $driverItems = $driverItems | Where-Object { $_.Name -notmatch 'wifi|wireless' } } $driverItems = $driverItems | Sort-Object -Property Name, FullName if ($Interactive) { $driverItems = $driverItems | Out-GridView -Title 'Select WinPE Drivers to add to this BootImage (Cancel to skip)' -PassThru } foreach ($item in $driverItems) { Get-Item -Path $item.FullName } } } |