private/WinPEDrivers/CloudWinPEDriver/Save-CloudWinPEDriverIntelWifi.ps1
|
#Requires -PSEdition Core function Save-CloudWinPEDriverIntelWifi { <# .SYNOPSIS Downloads and expands the Intel PROSet/Wireless IT Administrators driver pack. .DESCRIPTION Internal helper called by Save-CloudWinPEDriver. Downloads the Intel .zip to $env:ProgramData\OSDeployCore\downloads\, verifies the SHA256 checksum, removes stale expanded directories, and expands using Expand-CoreWinPEDriverZip. .PARAMETER DriverPackage A OSDeployWinPEDriver.Package object from Get-CloudWinPEDriver. .PARAMETER Force Re-download even if the file already exists and the hash matches. .OUTPUTS [System.IO.FileInfo] The downloaded .zip file. #> [CmdletBinding()] [OutputType([System.IO.FileInfo])] param ( [Parameter(Mandatory)] [PSTypeName('OSDeployWinPEDriver.Package')] [PSCustomObject]$DriverPackage, [Parameter()] [switch]$Force, [Parameter()] [switch]$DownloadOnly ) $package = $DriverPackage $idPrefix = ($package.Name -split '-')[0] $downloadDir = Join-Path $script:OSDeployCoreDownloadsPath $idPrefix $targetPath = Join-Path $downloadDir $package.FileName $driverDir = Join-Path $script:OSDeployCoreRepositoryPath 'winpe-drivers' | Join-Path -ChildPath $package.Architecture | Join-Path -ChildPath "$($package.Name)-$($package.Version)" Write-OSDeployWinPEDriversProgress -Message "Starting $($package.Name)" # Download $downloadedFile = Invoke-CloudWinPEDriverDownload ` -Uri $package.DownloadUri ` -DestinationPath $targetPath ` -SearchUri $package.UpdateUri ` -ExpectedSHA256 $package.Checksums.SHA256 ` -Force:$Force if ($DownloadOnly) { return $downloadedFile } # Expand zip $expandedFiles = Get-ChildItem -Path $driverDir -Recurse -File -ErrorAction SilentlyContinue if (-not $expandedFiles) { if (-not (Test-Path -Path $driverDir)) { New-Item -ItemType Directory -Path $driverDir -Force | Out-Null } Write-OSDeployWinPEDriversProgress -Message "Expand: $targetPath" Write-OSDeployWinPEDriversProgress -Message "Output: $driverDir" Write-Verbose "[$(Get-Date -format s)] [$($MyInvocation.MyCommand.Name)] Expanding '$($package.FileName)' to '$driverDir'" Expand-CoreWinPEDriverZip -Path $targetPath -DestinationPath $driverDir -Force:$Force } else { Write-Verbose "[$(Get-Date -format s)] [$($MyInvocation.MyCommand.Name)] '$driverDir' already contains expanded files. Skipping expansion." } $downloadedFile } |