Wax/Trace: per-bay FormTracePak version via bay-config.csv
Bays span 7 FormTracePak versions (5.510 - 6.213) and 3 sub-versions (AVANT / CV-4500 / CV-3200), each with a unique licensing USER ID. Previously all bays got v6.213 with no model/USER hint to the tech. - bay-config.csv: 15 rows mapping asset_tag to ftpak_version + model + user_id. - resolve-bay-config.ps1: WinPE-runnable resolver. Looks up the asset and writes version.txt / model.txt / userid.txt / bay-info.txt under W:\Enrollment\waxtrace\. - startnet.cmd: xcopy WaxTrace bundle minus formtracepak\, invoke the resolver with %MACHINENUM%, then cherry-pick only the matching FORMTRACEPAK-V<ver>.iso (~2 GB local vs ~12 GB if all were staged). - 09-Setup-WaxAndTrace.ps1: read the per-bay files, mount the right ISO, drop <asset>-FTPak-install-info.txt on SupportUser's desktop, and print a banner with MODEL + USER ID so the tech has them top-of-mind when Setup.exe dialogs come up. - sync-waxtrace.sh: loop over all FORMTRACEPAK-V*.iso instead of hard-coding v6.213; also push bay-config.csv + resolve-bay-config.ps1 to the share.
This commit is contained in:
@@ -91,53 +91,121 @@ if (-not (Test-Path $manifestPath)) {
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# Step 2: FormTracePak v6.213 vendor install (Mount-DiskImage + Setup.exe)
|
||||
# Step 2: FormTracePak vendor install - per-bay version + sub-version
|
||||
# ============================================================================
|
||||
# Detection: skip if Formtracepak already present (re-run safe).
|
||||
$ftpakExe = 'C:\Program Files (x86)\MitutoyoApp\Formtracepak\Formtracepak.exe'
|
||||
if (Test-Path -LiteralPath $ftpakExe) {
|
||||
Write-WTLog "Formtracepak.exe already present - skipping vendor install"
|
||||
} else {
|
||||
$ftpakIso = Join-Path $stagingRoot 'formtracepak\FORMTRACEPAK-V6.213.iso'
|
||||
if (-not (Test-Path -LiteralPath $ftpakIso)) {
|
||||
Write-WTLog "FormTracePak ISO not found at $ftpakIso" 'ERROR'
|
||||
# Per-bay config resolved by resolve-bay-config.ps1 at WinPE time + written
|
||||
# to C:\Enrollment\waxtrace\. Drives BOTH which FTPak ISO to mount AND what
|
||||
# to relay to the tech in the pre-install banner + desktop reference file.
|
||||
$waxCfgDir = 'C:\Enrollment\waxtrace'
|
||||
$bayAsset = $null
|
||||
$bayVersion = $null
|
||||
$bayModel = $null
|
||||
$bayUserId = $null
|
||||
foreach ($pair in @(
|
||||
@{ Var='bayAsset'; File='C:\Enrollment\machine-number.txt' },
|
||||
@{ Var='bayVersion'; File=(Join-Path $waxCfgDir 'version.txt') },
|
||||
@{ Var='bayModel'; File=(Join-Path $waxCfgDir 'model.txt') },
|
||||
@{ Var='bayUserId'; File=(Join-Path $waxCfgDir 'userid.txt') }
|
||||
)) {
|
||||
if (Test-Path -LiteralPath $pair.File) {
|
||||
$val = (Get-Content -LiteralPath $pair.File -First 1 -ErrorAction SilentlyContinue)
|
||||
if ($val) { Set-Variable -Name $pair.Var -Value $val.Trim() }
|
||||
}
|
||||
}
|
||||
Write-WTLog "Bay config: asset=$bayAsset version=$bayVersion model=$bayModel userid=$bayUserId"
|
||||
|
||||
if (-not $bayVersion) {
|
||||
Write-WTLog "No FormTracePak version in $waxCfgDir\version.txt - bay-config did not resolve (asset_tag not in bay-config.csv?). Manual install required." 'ERROR'
|
||||
} else {
|
||||
Write-WTLog "Mounting FormTracePak ISO: $ftpakIso"
|
||||
try {
|
||||
$img = Mount-DiskImage -ImagePath $ftpakIso -PassThru -ErrorAction Stop
|
||||
Start-Sleep -Seconds 8
|
||||
$vol = Get-DiskImage -ImagePath $ftpakIso | Get-Volume
|
||||
$ftpakDrive = $vol.DriveLetter
|
||||
if (-not $ftpakDrive) {
|
||||
Write-WTLog " Mount succeeded but no drive letter assigned" 'ERROR'
|
||||
} else {
|
||||
Write-WTLog " mounted at ${ftpakDrive}: (volume label=$($vol.FileSystemLabel))"
|
||||
$setupExe = "${ftpakDrive}:\Setup.exe"
|
||||
if (-not [System.IO.File]::Exists($setupExe)) {
|
||||
Write-WTLog " Setup.exe not found at $setupExe" 'ERROR'
|
||||
$ftpakIso = Join-Path $stagingRoot ("formtracepak\FORMTRACEPAK-V$bayVersion.iso")
|
||||
if (-not (Test-Path -LiteralPath $ftpakIso)) {
|
||||
Write-WTLog "FormTracePak ISO missing: $ftpakIso" 'ERROR'
|
||||
Write-WTLog " Bay needs V$bayVersion but no matching ISO at the expected path. Either bay-config.csv has the wrong version, or sync-waxtrace.sh did not push the right ISO. Manual install required." 'ERROR'
|
||||
} else {
|
||||
# Drop a reference text file on the SupportUser Desktop so the tech
|
||||
# always has the model + USER ID in front of them when the Setup.exe
|
||||
# dialogs come up. File persists post-imaging.
|
||||
try {
|
||||
$desktop = 'C:\Users\SupportUser\Desktop'
|
||||
if (-not (Test-Path -LiteralPath $desktop)) { $desktop = 'C:\Users\Public\Desktop' }
|
||||
$deskFile = Join-Path $desktop ("$bayAsset-FTPak-install-info.txt")
|
||||
$deskContent = @(
|
||||
'========================================',
|
||||
'FormTracePak install info for this bay',
|
||||
'========================================',
|
||||
'',
|
||||
"Bay: $bayAsset",
|
||||
"FormTracePak: V$bayVersion",
|
||||
"Sub-version: $bayModel <- SELECT THIS IN THE Setup.exe DIALOG",
|
||||
"USER ID: $bayUserId <- ENTER THIS AT THE LICENSING PROMPT",
|
||||
'',
|
||||
'Reference file. Open this whenever you need to recall the USER ID',
|
||||
'during the install dialogs.',
|
||||
'',
|
||||
"Generated at imaging time by 09-Setup-WaxAndTrace.ps1 ($(Get-Date -Format 'yyyy-MM-dd HH:mm:ss'))"
|
||||
) -join "`r`n"
|
||||
Set-Content -LiteralPath $deskFile -Value $deskContent -Force
|
||||
Write-WTLog "Wrote reference file to $deskFile"
|
||||
} catch {
|
||||
Write-WTLog "Failed to write desktop reference file: $_" 'WARN'
|
||||
}
|
||||
|
||||
# Big banner in the PS host window. Operator sees this BEFORE Setup.exe
|
||||
# opens so the model + USER ID are top-of-mind when the dialogs come up.
|
||||
$bannerLines = @(
|
||||
'',
|
||||
'================================================================',
|
||||
" BAY: $bayAsset",
|
||||
" FORMTRACEPAK: V$bayVersion",
|
||||
" SELECT MODEL: $bayModel",
|
||||
" USER ID: $bayUserId",
|
||||
'================================================================',
|
||||
' Setup.exe is about to launch. In its dialogs:',
|
||||
" - Pick the MODEL '$bayModel' on the language / model page.",
|
||||
" - Enter USER ID '$bayUserId' at the licensing prompt.",
|
||||
" - A reference text file with these values has been placed on",
|
||||
" SupportUser's desktop ($bayAsset-FTPak-install-info.txt).",
|
||||
'================================================================',
|
||||
''
|
||||
)
|
||||
foreach ($l in $bannerLines) { Write-WTLog $l }
|
||||
|
||||
Write-WTLog "Mounting FormTracePak ISO: $ftpakIso"
|
||||
try {
|
||||
$img = Mount-DiskImage -ImagePath $ftpakIso -PassThru -ErrorAction Stop
|
||||
Start-Sleep -Seconds 8
|
||||
$vol = Get-DiskImage -ImagePath $ftpakIso | Get-Volume
|
||||
$ftpakDrive = $vol.DriveLetter
|
||||
if (-not $ftpakDrive) {
|
||||
Write-WTLog " Mount succeeded but no drive letter assigned" 'ERROR'
|
||||
} else {
|
||||
Write-WTLog " running $setupExe (VB6 wrapper - requires DRIVE_CDROM)"
|
||||
# Setup.exe is the VB6 wrapper. /silent + /qn flags often
|
||||
# ignored - the wrapper drives appSetup.exe + msiexec from
|
||||
# its own UI. If the wrapper insists on interactive, a tech
|
||||
# at the bay clicks through. Acceptable today; quieter
|
||||
# path is a future improvement (drive msiexec direct on
|
||||
# the wrapper's bundled MSIs).
|
||||
try {
|
||||
$p = Start-Process -FilePath $setupExe `
|
||||
-WorkingDirectory "${ftpakDrive}:\" `
|
||||
-ArgumentList '/silent' `
|
||||
-Wait -PassThru
|
||||
Write-WTLog " Setup.exe exit $($p.ExitCode)"
|
||||
} catch {
|
||||
Write-WTLog " Setup.exe failed: $_" 'ERROR'
|
||||
Write-WTLog " mounted at ${ftpakDrive}: (volume label=$($vol.FileSystemLabel))"
|
||||
$setupExe = "${ftpakDrive}:\Setup.exe"
|
||||
if (-not [System.IO.File]::Exists($setupExe)) {
|
||||
Write-WTLog " Setup.exe not found at $setupExe" 'ERROR'
|
||||
} else {
|
||||
Write-WTLog " running $setupExe (VB6 wrapper - requires DRIVE_CDROM)"
|
||||
try {
|
||||
$p = Start-Process -FilePath $setupExe `
|
||||
-WorkingDirectory "${ftpakDrive}:\" `
|
||||
-ArgumentList '/silent' `
|
||||
-Wait -PassThru
|
||||
Write-WTLog " Setup.exe exit $($p.ExitCode)"
|
||||
} catch {
|
||||
Write-WTLog " Setup.exe failed: $_" 'ERROR'
|
||||
}
|
||||
}
|
||||
}
|
||||
Dismount-DiskImage -ImagePath $ftpakIso -ErrorAction SilentlyContinue | Out-Null
|
||||
Write-WTLog " FormTracePak ISO dismounted"
|
||||
} catch {
|
||||
Write-WTLog " Mount-DiskImage failed: $_" 'ERROR'
|
||||
}
|
||||
Dismount-DiskImage -ImagePath $ftpakIso -ErrorAction SilentlyContinue | Out-Null
|
||||
Write-WTLog " FormTracePak ISO dismounted"
|
||||
} catch {
|
||||
Write-WTLog " Mount-DiskImage failed: $_" 'ERROR'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
asset_tag,ftpak_version,model,user_id
|
||||
WJF00159,6.103,AVANT,3974839712
|
||||
WJRP3689,5.510,CV-4500,3744284509
|
||||
WJRP2660,6.0,CV-4500,2365986521
|
||||
WJRP2659,6.0,CV-4500,2709054503
|
||||
WJF00545,6.213,AVANT,3878777362
|
||||
WJRP3638,5.602,CV-4500,0720778210
|
||||
WJF00052,6.103,AVANT,3270314998
|
||||
WJF00084,6.103,AVANT,1476212857
|
||||
WJF00083,6.103,AVANT,2934506987
|
||||
WJRP3025,6.0,CV-3200,2292822471
|
||||
WJF00197,6.104,AVANT,1191612605
|
||||
WJRP4802,6.002,AVANT,0920866935
|
||||
WJRP2347,6.0,CV-4500,3585172946
|
||||
WJRP2035,6.0,CV-4500,2292822471
|
||||
WJRP2335,6.0,CV-4500,1780916688
|
||||
|
@@ -0,0 +1,90 @@
|
||||
# resolve-bay-config.ps1 - WinPE-runnable bay-config resolver.
|
||||
#
|
||||
# Reads bay-config.csv (per-asset ftpak_version + model + user_id) and
|
||||
# writes the matched row into per-field text files under $OutDir, so the
|
||||
# rest of startnet.cmd + the post-imaging 09-Setup-WaxAndTrace.ps1 can
|
||||
# read them as single-line files (cheaper than re-parsing CSV in batch).
|
||||
#
|
||||
# Outputs (under $OutDir, default W:\Enrollment\waxtrace\):
|
||||
# version.txt - exact FormTracePak version (matches an installer ISO label)
|
||||
# model.txt - sub-version (AVANT / CV-4500 / CV-3200)
|
||||
# userid.txt - per-bay license USER ID
|
||||
# bay-info.txt - human-readable audit dump (timestamped)
|
||||
#
|
||||
# Exit codes:
|
||||
# 0 - row found + files written
|
||||
# 1 - asset_tag not in bay-config.csv (Wax/Trace install will abort cleanly)
|
||||
# 2 - bay-config.csv missing or unparseable
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory=$true)][string]$Asset,
|
||||
[string]$ConfigCsv = '',
|
||||
[string]$OutDir = 'W:\Enrollment\waxtrace'
|
||||
)
|
||||
|
||||
# Default ConfigCsv: bay-config.csv next to this script on the share OR
|
||||
# under the script's own directory in the local C:\WaxTrace-Install\ tree
|
||||
# (depending on where the caller invokes us from).
|
||||
if (-not $ConfigCsv) {
|
||||
$cands = @(
|
||||
(Join-Path $PSScriptRoot 'bay-config.csv'),
|
||||
(Join-Path $PSScriptRoot '..\bay-config.csv'),
|
||||
'Y:\installers-post\waxtrace\bay-config.csv',
|
||||
'C:\WaxTrace-Install\bay-config.csv'
|
||||
)
|
||||
foreach ($c in $cands) {
|
||||
if (Test-Path -LiteralPath $c) { $ConfigCsv = $c; break }
|
||||
}
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $ConfigCsv)) {
|
||||
Write-Warning "bay-config.csv not found (looked under $PSScriptRoot, ..\, Y:\installers-post\waxtrace\, C:\WaxTrace-Install\)"
|
||||
exit 2
|
||||
}
|
||||
|
||||
Write-Host "resolve-bay-config.ps1: looking up '$Asset' in $ConfigCsv"
|
||||
|
||||
try {
|
||||
$rows = @(Import-Csv -LiteralPath $ConfigCsv)
|
||||
} catch {
|
||||
Write-Warning "Failed to parse ${ConfigCsv}: $_"
|
||||
exit 2
|
||||
}
|
||||
|
||||
$row = $rows | Where-Object { $_.asset_tag -ieq $Asset } | Select-Object -First 1
|
||||
if (-not $row) {
|
||||
Write-Warning "Asset '$Asset' not in $ConfigCsv. Available asset_tags: $(($rows.asset_tag | Sort-Object) -join ', ')"
|
||||
exit 1
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $OutDir)) {
|
||||
New-Item -ItemType Directory -Path $OutDir -Force | Out-Null
|
||||
}
|
||||
|
||||
function Write-Line {
|
||||
param([string]$Name, [string]$Value)
|
||||
$p = Join-Path $OutDir $Name
|
||||
Set-Content -LiteralPath $p -Value $Value -NoNewline -Force
|
||||
Write-Host " wrote $p = '$Value'"
|
||||
}
|
||||
|
||||
Write-Line 'version.txt' $row.ftpak_version
|
||||
Write-Line 'model.txt' $row.model
|
||||
Write-Line 'userid.txt' $row.user_id
|
||||
|
||||
$infoLines = @(
|
||||
"Bay-config resolved at $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss')",
|
||||
" Asset: $($row.asset_tag)",
|
||||
" FormTracePak: V$($row.ftpak_version)",
|
||||
" Sub-version: $($row.model)",
|
||||
" USER ID: $($row.user_id)",
|
||||
"",
|
||||
"Source: $ConfigCsv"
|
||||
)
|
||||
$infoPath = Join-Path $OutDir 'bay-info.txt'
|
||||
Set-Content -LiteralPath $infoPath -Value ($infoLines -join "`r`n") -Force
|
||||
Write-Host " wrote $infoPath"
|
||||
|
||||
Write-Host "resolve-bay-config.ps1: OK"
|
||||
exit 0
|
||||
Reference in New Issue
Block a user