private/Get-WinPEDriverPackageIntelWifi.ps1
|
#Requires -PSEdition Core function Get-WinPEDriverPackageIntelWifi { <# .SYNOPSIS Gets Intel wireless driver pack metadata .DESCRIPTION Reads the Intel wireless UpdateUri from the global WinPE driver configuration, requests the download page with curl.exe, and extracts the current amd64 IT Administrators ZIP, mirror identifier, version, release notes URI, optional SHA256 checksum, file size, and release date. The function downloads no driver package. Failures produce a warning and no object. .EXAMPLE PS> Get-WinPEDriverPackageIntelWifi Returns current Intel wireless package metadata parsed from the configured page. .INPUTS None. This function does not accept pipeline input. .OUTPUTS System.Management.Automation.PSCustomObject. Returns one object with Architecture, ReadmeUri, PackageId, Version, ReleaseDate, FileName, FileSizeMB, DownloadUri, and Checksums properties, or no object on failure. Optional metadata can be null or empty when it is absent from the page. .NOTES Author: David Segura Company: Recast Software Version: 1.0.0 Date: 2026-08-28 Dependencies: Executables: curl.exe Network Resources: Configured Intel wireless UpdateUri DotNet Classes: System.Globalization.CultureInfo, System.Management.Automation.PSCustomObject #> [CmdletBinding()] [OutputType([PSCustomObject[]])] param () try { $searchUri = $global:OSDeployModule.WinPEDrivers.'intel-wifi'.UpdateUri if ([string]::IsNullOrWhiteSpace($searchUri)) { throw "intel-wifi UpdateUri is not defined in winpedrivers.json." } $convertReleaseDate = { param([string]$Value) foreach ($format in @('M/d/yyyy', 'MM/dd/yyyy', 'MMMM d, yyyy', 'MMM d, yyyy', 'yyyy-MM-dd')) { try { return [datetime]::ParseExact( $Value, $format, [System.Globalization.CultureInfo]::InvariantCulture ).ToString('yyyy-MM-dd') } catch { } } try { ([datetime]$Value).ToString('yyyy-MM-dd') } catch { $Value } } Write-Verbose "[$($MyInvocation.MyCommand.Name)] Fetching Intel download page '$searchUri'" $html = curl.exe --location --fail --silent --show-error --retry 3 $searchUri if ($LASTEXITCODE -ne 0) { throw "curl.exe failed (exit $LASTEXITCODE) requesting '$searchUri'." } $html = $html -join [Environment]::NewLine # Find the direct IT Administrators zip download URL in page source. $downloadUriMatch = [regex]::Match( $html, '(?i)(https://downloadmirror\.intel\.com/(?<Id>\d{6,7})/(?<FileName>WiFi-(?<Version>\d+\.\d+\.\d+)-Driver64-Win10-Win11\.zip))' ) if (-not $downloadUriMatch.Success) { Write-Warning "[$(Get-Date -Format s)] Could not find Intel wireless zip download URL on page '$searchUri'. Page format may have changed." return } $downloadUri = $downloadUriMatch.Groups[1].Value $mirrorId = $downloadUriMatch.Groups['Id'].Value $fileName = $downloadUriMatch.Groups['FileName'].Value $version = $downloadUriMatch.Groups['Version'].Value $readmeUri = "https://downloadmirror.intel.com/$mirrorId/ReleaseNotes_WiFi_${version}_IT.pdf" Write-Verbose "[$($MyInvocation.MyCommand.Name)] Found DownloadUri='$downloadUri'" # Extract SHA256 — usually shown next to the zip filename on the page $sha256Match = [regex]::Match($html, '(?i)sha256[:\s]+([A-Fa-f0-9]{64})') $sha256 = $sha256Match.Groups[1].Value.Trim() # Extract file size in MB $fileSizeMB = $null $sizeMatch = [regex]::Match($html, '(?i)(\d+(?:\.\d+)?)\s*MB') if ($sizeMatch.Success) { $fileSizeMB = [double]$sizeMatch.Groups[1].Value } # Extract release date from page metadata first, then fall back to visible text. $releaseDate = $null $dateMatch = [regex]::Match( $html, '(?i)<meta[^>]+name="(?:lastModifieddate|LastUpdate)"[^>]+content="(?<Date>\d{1,2}/\d{1,2}/\d{4})(?:\s+\d{2}:\d{2}:\d{2})?"' ) if (-not $dateMatch.Success) { $dateMatch = [regex]::Match($html, '(?i)(?:date|released)[:\s]+(\d{1,2}/\d{1,2}/\d{4}|[A-Za-z]+\s+\d{1,2},\s+\d{4})') } if ($dateMatch.Success) { $releaseDateValue = if ($dateMatch.Groups['Date'].Success) { $dateMatch.Groups['Date'].Value } else { $dateMatch.Groups[1].Value } $releaseDate = & $convertReleaseDate $releaseDateValue } $checksums = @{} if ($sha256) { $checksums['SHA256'] = $sha256 } Write-Verbose "[$($MyInvocation.MyCommand.Name)] PackageId='$mirrorId' Version='$version' ReleaseDate='$releaseDate'" @( [PSCustomObject]@{ Architecture = 'amd64' ReadmeUri = $readmeUri PackageId = $mirrorId Version = $version ReleaseDate = $releaseDate FileName = $fileName FileSizeMB = $fileSizeMB DownloadUri = $downloadUri Checksums = [PSCustomObject]$checksums } ) } catch { Write-Warning "[$(Get-Date -Format s)] $($_.Exception.Message)" if ($searchUri) { Write-Warning "[$(Get-Date -Format s)] URL: $searchUri" } } } |