Shopfloor scripts: em-dash to hyphen, add positional Level param

Replace em-dash characters with plain hyphens across the 5 shopfloor
setup scripts (avoids cp1252 mojibake in .bat files and keeps the
PowerShell sources consistent). Also adds [Parameter(Position=1)] to
Write-PreInstallLog so the Level argument can be passed positionally.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-04-08 14:24:37 -04:00
parent a1a78e2ba3
commit ded0a7184b
5 changed files with 13 additions and 12 deletions

View File

@@ -1,9 +1,9 @@
# 00-PreInstall-MachineApps.ps1 Install pre-staged apps from C:\PreInstall (Shopfloor baseline)
# 00-PreInstall-MachineApps.ps1 - Install pre-staged apps from C:\PreInstall (Shopfloor baseline)
#
# Reads C:\PreInstall\preinstall.json (staged by startnet.cmd during WinPE phase) and
# installs each app whose PCTypes filter matches the current PC type. Detection runs first
# so already-installed apps are skipped. Numbered 00- so it runs before all other Shopfloor
# baseline scripts apps need to exist before later scripts (e.g. 01-eDNC.ps1) reference
# baseline scripts - apps need to exist before later scripts (e.g. 01-eDNC.ps1) reference
# them or rely on their state.
#
# Failure mode: log + continue. Intune DSC (Simple-Install.ps1) is the safety net for any
@@ -20,7 +20,7 @@ $logFile = Join-Path $logDir "install.log"
# --- Setup logging ---
# IMPORTANT: do NOT wipe the log on each run. The runner can get killed by an
# installer-triggered reboot mid-execution. On the next autologon, the dispatcher
# re-runs us if we wipe the log here, we destroy the forensic record from the
# re-runs us - if we wipe the log here, we destroy the forensic record from the
# previous (interrupted) run. Instead, append a session header so runs are visible
# but history is preserved.
if (-not (Test-Path $logDir)) {
@@ -31,6 +31,7 @@ function Write-PreInstallLog {
param(
[Parameter(Mandatory=$true, Position=0)]
[string]$Message,
[Parameter(Position=1)]
[ValidateSet('INFO','WARN','ERROR')]
[string]$Level = 'INFO'
)
@@ -148,7 +149,7 @@ $failed = 0
foreach ($app in $config.Applications) {
# Cancel any reboot a previous installer scheduled (some respect /norestart, some
# don't VC++ 2008's bootstrapper sometimes triggers an immediate Windows reboot
# don't - VC++ 2008's bootstrapper sometimes triggers an immediate Windows reboot
# despite the flag). Doing this BEFORE each install protects the rest of the loop.
& shutdown.exe /a 2>$null
@@ -216,7 +217,7 @@ foreach ($app in $config.Applications) {
while ($elapsed -lt $timeoutSec) {
if ($proc.HasExited) { break }
# If detection passes mid-install, the installer already did its job
# If detection passes mid-install, the installer already did its job -
# we can kill any zombie process (like UDC_Setup.exe waiting on its hidden
# WPF window) and move on.
if (Test-AppInstalled -App $app) {
@@ -276,7 +277,7 @@ Write-PreInstallLog "============================================"
Write-PreInstallLog "PreInstall complete: $installed installed, $skipped skipped, $failed failed"
Write-PreInstallLog "============================================"
# Final reboot cancel if the last installer in the loop scheduled one, the
# Final reboot cancel - if the last installer in the loop scheduled one, the
# dispatcher's later `shutdown /a` won't fire until the next baseline script starts.
# Cancel here so control returns cleanly to Run-ShopfloorSetup.ps1.
& shutdown.exe /a 2>$null