<# .SYNOPSIS Return the tenant + PC purpose, pre-seeded if WinPE already asked. .DESCRIPTION Start-BulkEnrollOrchestrator.ps1 calls this at first logon and captures stdout: $pcType = powershell.exe -File 'C:\Deploy\Applications\BPRT\Select-PCConfig.ps1' -LogoPath '...' It uses the answer twice - to pick which MCL package to apply, and to select which bulk token Insert-BPRTToPPKG.ps1 injects (it matches on Tenant AND Purpose). The vendor's version asks with a GUI, which means an otherwise unattended build stops at a dialog until somebody walks over. startnet.cmd now asks the same question at the PXE menu, while the tech who knows what the machine is for is standing at it, and writes the answer to C:\Enrollment\pc-config.txt. This shim returns that value when present and falls through to the vendor dialog when it is not - so nothing is lost if the tech picks "ask at first logon", or on a bay imaged before this existed. ONLY the choice is pre-seeded. Token injection still happens at first logon: Insert-BPRTToPPKG.ps1 fetches an encrypted token table from mcl.dwcdn.geaerospace.com, which is unreachable from the isolated imaging LAN. .OUTPUTS "{Tenant}_{PCType}" - Tenant GCCH|RoW, PCType PERS|SH|LOAN. Identical contract to the vendor script. .NOTES The vendor script is kept alongside as Select-PCConfig-vendor.ps1. Replace THAT file when the vendor ships a new one; this shim only needs changing if the return contract changes. #> param( [Parameter(Mandatory = $false)] [string]$LogoPath ) $seedFile = 'C:\Enrollment\pc-config.txt' $vendor = Join-Path $PSScriptRoot 'Select-PCConfig-vendor.ps1' $logDir = 'C:\Logs\BPRT\Orchestrator' $shimLog = Join-Path $logDir 'Select-PCConfig-shim.log' function Log { param([string]$Message) try { New-Item -ItemType Directory -Path $logDir -Force -ErrorAction SilentlyContinue | Out-Null Add-Content -Path $shimLog -Value ("{0} {1}" -f (Get-Date -Format 'yyyy-MM-dd HH:mm:ss'), $Message) } catch { } } # Valid values, so a typo in the seed file falls back to the dialog instead of # handing the orchestrator a string that matches no token and no package. $validTenants = @('GCCH', 'RoW') $validPurposes = @('PERS', 'SH', 'LOAN') if (Test-Path $seedFile) { $seed = (Get-Content $seedFile -First 1 -ErrorAction SilentlyContinue) if ($seed) { $seed = $seed.Trim() } $parts = if ($seed) { $seed.Split('_') } else { @() } if ($parts.Count -eq 2 -and $validTenants -contains $parts[0] -and $validPurposes -contains $parts[1]) { Log "Pre-seeded value '$seed' from $seedFile - dialog skipped." Write-Output $seed exit 0 } Log "Ignoring malformed pre-seed '$seed' in $seedFile; falling back to the dialog." } if (Test-Path $vendor) { Log "No usable pre-seed; showing the vendor dialog." if ($LogoPath) { & $vendor -LogoPath $LogoPath } else { & $vendor } exit $LASTEXITCODE } # Neither a seed nor the vendor dialog. Say so in the log rather than returning # something invented - the orchestrator would inject the wrong token. Log "ERROR: no pre-seed at $seedFile and no vendor script at $vendor." exit 1