private/BootMedia/Steps/Get-WindowsAdkPaths.ps1
|
#Requires -PSEdition Core function Get-WindowsAdkPaths { <# .SYNOPSIS Resolves all ADK tool paths for a given architecture and ADK root. .DESCRIPTION Given an architecture (amd64 or arm64) and the ADK root path, returns a PSObject containing all resolved paths to ADK tools, deployment directories, WinPE OC packages, and key executables. .PARAMETER Architecture The processor architecture: amd64 or arm64. .PARAMETER AdkRoot The full path to the ADK root directory (Assessment and Deployment Kit). .OUTPUTS PSObject with resolved ADK tool paths. .NOTES Author: David Segura Version: 0.1.0 #> [CmdletBinding()] param ( [Parameter(Mandatory)] [ValidateSet('amd64', 'arm64')] [System.String] $Architecture, [Parameter(Mandatory)] [ValidateNotNullOrEmpty()] [System.String] $AdkRoot ) if (-not (Test-Path -Path $AdkRoot)) { Write-Warning "ADK root path not found: $AdkRoot" return $null } $deployTools = Join-Path $AdkRoot "Deployment Tools\$Architecture" $winpeRoot = Join-Path $AdkRoot 'Windows Preinstallation Environment' $winpeArch = Join-Path $winpeRoot $Architecture # Determine the WinPE source WIM path $wimSourcePath = Join-Path $winpeArch 'en-us\winpe.wim' if (-not (Test-Path $wimSourcePath)) { # Try without language subdirectory $wimSourcePath = Join-Path $winpeArch 'winpe.wim' } $result = [ordered]@{ AdkRoot = $AdkRoot PathBCDBoot = Join-Path $deployTools 'BCDBoot' PathDeploymentTools = $deployTools PathDISM = Join-Path $deployTools 'DISM' PathOscdimg = Join-Path $deployTools 'Oscdimg' PathUsmt = Join-Path $AdkRoot "User State Migration Tool\$Architecture" PathWinPE = $winpeArch PathWinPEMedia = Join-Path $winpeArch 'Media' PathWinSetup = Join-Path $AdkRoot "Windows Setup\$Architecture" WinPEOCs = Join-Path $winpeArch 'WinPE_OCs' WinPERoot = $winpeRoot WimSourcePath = $wimSourcePath bcdbootexe = Join-Path $deployTools 'BCDBoot\bcdboot.exe' bcdeditexe = Join-Path $deployTools 'BCDBoot\bcdedit.exe' bootsectexe = Join-Path $deployTools 'BCDBoot\bootsect.exe' dismexe = Join-Path $deployTools 'DISM\dism.exe' efisysbin = Join-Path $deployTools 'Oscdimg\efisys.bin' efisysnopromptbin = Join-Path $deployTools 'Oscdimg\efisys_noprompt.bin' etfsbootcom = Join-Path $deployTools 'Oscdimg\etfsboot.com' imagexexe = Join-Path $deployTools 'DISM\imagex.exe' oa3toolexe = Join-Path $deployTools 'Licensing\OA30\oa3tool.exe' oscdimgexe = Join-Path $deployTools 'Oscdimg\oscdimg.exe' pkgmgrexe = Join-Path $deployTools 'DISM\pkgmgr.exe' } [PSCustomObject]$result } |