Files
pxe-server/playbook/shopfloor-setup/gea-shopfloor-heattreat/01-eDNC.ps1
cproudlock 1e6603d331 eDNC: default to single shared installer (C:\PreInstall\installers\dnc\eDNC-6.4.7.msi)
01-eDNC.ps1 (all 4 DNC types) now installs eDNC from the shared pre-install copy
staged by startnet.cmd to C:\PreInstall\installers\dnc - one source of truth
(currently 6.4.7) instead of a per-type bundled msi. Falls back to the per-type
eDNC\ folder when the shared copy is absent (older images). eMxInfo.txt, the
x86->64 mirror, and Site/MachineNo registry steps are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-05 10:45:24 -04:00

120 lines
4.9 KiB
PowerShell

# 01-eDNC.ps1 - Install eDNC and deploy custom eMxInfo.txt (Standard-Machine only)
# --- Transcript ---
$logDir = 'C:\Logs\SFLD'
if (-not (Test-Path $logDir)) { try { New-Item -ItemType Directory -Path $logDir -Force | Out-Null } catch {} }
try { Start-Transcript -Path (Join-Path $logDir '01-eDNC.log') -Append -Force | Out-Null } catch {}
# --- Skip on Timeclock sub-type ---
$subtypeFile = 'C:\Enrollment\pc-subtype.txt'
if (Test-Path $subtypeFile) {
$subtype = (Get-Content $subtypeFile -First 1 -ErrorAction SilentlyContinue).Trim()
if ($subtype -eq 'Timeclock') {
Write-Host "=== eDNC Setup: skipped (Standard-Timeclock) ==="
try { Stop-Transcript | Out-Null } catch {}
return
}
}
Write-Host "=== eDNC Setup ==="
function Get-SiteConfig {
$configPath = 'C:\Enrollment\site-config.json'
if (-not (Test-Path -LiteralPath $configPath)) {
Write-Host "site-config.json not found - using defaults" -ForegroundColor DarkGray
return $null
}
try {
return (Get-Content -LiteralPath $configPath -Raw -ErrorAction Stop | ConvertFrom-Json)
} catch {
Write-Warning "Failed to parse site-config.json: $_"
return $null
}
}
$siteConfig = Get-SiteConfig
$siteName = if ($siteConfig) { $siteConfig.siteName } else { 'West Jefferson' }
$siteNameCompact = if ($siteConfig) { $siteConfig.siteNameCompact } else { 'WestJefferson' }
$edncDir = Join-Path $PSScriptRoot 'eDNC'
if (-not (Test-Path $edncDir)) {
Write-Warning "eDNC folder not found at $edncDir - skipping."
try { Stop-Transcript | Out-Null } catch {}
exit 0
}
# --- Find installer ---
# Default DNC install is the single shared copy staged by startnet.cmd to
# C:\PreInstall\installers\dnc (currently eDNC-6.4.7.msi) - one source of truth
# across every DNC pc-type instead of a per-type msi. Fall back to the per-type
# eDNC\ folder for older images that still bundle their own. Filter is eDNC*.msi
# (no dash) so both vendor naming styles match: eDNC-6.4.7.msi and eDNC_6-4-5.msi.
$sharedDncDir = 'C:\PreInstall\installers\dnc'
$edncMsi = Get-ChildItem -Path $sharedDncDir -Filter "eDNC*.msi" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($edncMsi) {
Write-Host "Using shared DNC installer: $($edncMsi.FullName)"
} else {
$edncMsi = Get-ChildItem -Path $edncDir -Filter "eDNC*.msi" -ErrorAction SilentlyContinue | Select-Object -First 1
if ($edncMsi) { Write-Host "Shared DNC installer not found - falling back to per-type: $($edncMsi.FullName)" }
}
$emxInfo = Join-Path $edncDir "eMxInfo.txt"
# --- 1. Install eDNC ---
if ($edncMsi) {
Write-Host "Installing eDNC: $($edncMsi.Name)..."
$p = Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$($edncMsi.FullName)`" /qn /norestart LAUNCHNTLARS=false SITESELECTED=`"$siteName`"" -Wait -PassThru
Write-Host " eDNC exit code: $($p.ExitCode)"
} else {
Write-Warning "eDNC installer not found in $edncDir (expected eDNC*.msi)"
}
# --- 2. Mirror x86 install to 64-bit Program Files (app uses hardcoded paths) ---
# mxTransactionDll.dll references \Dnc\Server Files\
$copies = @(
@{ Src = "C:\Program Files (x86)\Dnc"; Dst = "C:\Program Files\Dnc" }
)
foreach ($c in $copies) {
if (Test-Path $c.Src) {
if (-not (Test-Path $c.Dst)) {
New-Item -Path $c.Dst -ItemType Directory -Force | Out-Null
}
Copy-Item -Path "$($c.Src)\*" -Destination $c.Dst -Recurse -Force
Write-Host " Copied $($c.Src) -> $($c.Dst)"
}
}
# --- 3. Set DNC site + machine number ---
$regBase = "HKLM\SOFTWARE\WOW6432Node\GE Aircraft Engines\DNC"
reg add "$regBase\General" /v Site /t REG_SZ /d $siteNameCompact /f | Out-Null
Write-Host " DNC site set to $siteNameCompact."
# Set machine number if tech entered one during PXE menu (defaults to 9999)
$machineNumFile = 'C:\Enrollment\machine-number.txt'
$machineNum = '9999'
if (Test-Path -LiteralPath $machineNumFile) {
$num = (Get-Content -LiteralPath $machineNumFile -First 1 -ErrorAction SilentlyContinue).Trim()
if ($num -and $num -match '^\d+$') { $machineNum = $num }
}
reg add "$regBase\General" /v MachineNo /t REG_SZ /d $machineNum /f | Out-Null
Write-Host " DNC MachineNo set to $machineNum."
# --- 4. Deploy custom eMxInfo.txt to both Program Files paths ---
if (Test-Path $emxInfo) {
$dest86 = "C:\Program Files (x86)\DNC\Server Files"
$dest64 = "C:\Program Files\DNC\Server Files"
foreach ($dest in @($dest86, $dest64)) {
if (-not (Test-Path $dest)) {
New-Item -Path $dest -ItemType Directory -Force | Out-Null
}
Copy-Item -Path $emxInfo -Destination (Join-Path $dest "eMxInfo.txt") -Force
Write-Host " eMxInfo.txt -> $dest"
}
} else {
Write-Warning "eMxInfo.txt not found at $emxInfo"
}
Write-Host "=== eDNC Setup Complete ==="
try { Stop-Transcript | Out-Null } catch {}