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:
@@ -1,4 +1,4 @@
|
|||||||
# Run-ShopfloorSetup.ps1 — Dispatcher for shopfloor PC type setup
|
# Run-ShopfloorSetup.ps1 - Dispatcher for shopfloor PC type setup
|
||||||
# Runs Shopfloor baseline scripts first, then type-specific scripts on top.
|
# Runs Shopfloor baseline scripts first, then type-specific scripts on top.
|
||||||
|
|
||||||
# Bump AutoLogonCount HIGH at the start so reboots during setup (e.g. VC++ 2008
|
# Bump AutoLogonCount HIGH at the start so reboots during setup (e.g. VC++ 2008
|
||||||
|
|||||||
@@ -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
|
# 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
|
# 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
|
# 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.
|
# them or rely on their state.
|
||||||
#
|
#
|
||||||
# Failure mode: log + continue. Intune DSC (Simple-Install.ps1) is the safety net for any
|
# 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 ---
|
# --- Setup logging ---
|
||||||
# IMPORTANT: do NOT wipe the log on each run. The runner can get killed by an
|
# 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
|
# 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
|
# previous (interrupted) run. Instead, append a session header so runs are visible
|
||||||
# but history is preserved.
|
# but history is preserved.
|
||||||
if (-not (Test-Path $logDir)) {
|
if (-not (Test-Path $logDir)) {
|
||||||
@@ -31,6 +31,7 @@ function Write-PreInstallLog {
|
|||||||
param(
|
param(
|
||||||
[Parameter(Mandatory=$true, Position=0)]
|
[Parameter(Mandatory=$true, Position=0)]
|
||||||
[string]$Message,
|
[string]$Message,
|
||||||
|
[Parameter(Position=1)]
|
||||||
[ValidateSet('INFO','WARN','ERROR')]
|
[ValidateSet('INFO','WARN','ERROR')]
|
||||||
[string]$Level = 'INFO'
|
[string]$Level = 'INFO'
|
||||||
)
|
)
|
||||||
@@ -148,7 +149,7 @@ $failed = 0
|
|||||||
|
|
||||||
foreach ($app in $config.Applications) {
|
foreach ($app in $config.Applications) {
|
||||||
# Cancel any reboot a previous installer scheduled (some respect /norestart, some
|
# 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.
|
# despite the flag). Doing this BEFORE each install protects the rest of the loop.
|
||||||
& shutdown.exe /a 2>$null
|
& shutdown.exe /a 2>$null
|
||||||
|
|
||||||
@@ -216,7 +217,7 @@ foreach ($app in $config.Applications) {
|
|||||||
while ($elapsed -lt $timeoutSec) {
|
while ($elapsed -lt $timeoutSec) {
|
||||||
if ($proc.HasExited) { break }
|
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
|
# we can kill any zombie process (like UDC_Setup.exe waiting on its hidden
|
||||||
# WPF window) and move on.
|
# WPF window) and move on.
|
||||||
if (Test-AppInstalled -App $app) {
|
if (Test-AppInstalled -App $app) {
|
||||||
@@ -276,7 +277,7 @@ Write-PreInstallLog "============================================"
|
|||||||
Write-PreInstallLog "PreInstall complete: $installed installed, $skipped skipped, $failed failed"
|
Write-PreInstallLog "PreInstall complete: $installed installed, $skipped skipped, $failed failed"
|
||||||
Write-PreInstallLog "============================================"
|
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.
|
# dispatcher's later `shutdown /a` won't fire until the next baseline script starts.
|
||||||
# Cancel here so control returns cleanly to Run-ShopfloorSetup.ps1.
|
# Cancel here so control returns cleanly to Run-ShopfloorSetup.ps1.
|
||||||
& shutdown.exe /a 2>$null
|
& shutdown.exe /a 2>$null
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
# 01-eDNC.ps1 — Install eDNC and deploy custom eMxInfo.txt (Standard)
|
# 01-eDNC.ps1 - Install eDNC and deploy custom eMxInfo.txt (Standard)
|
||||||
|
|
||||||
Write-Host "=== eDNC Setup ==="
|
Write-Host "=== eDNC Setup ==="
|
||||||
|
|
||||||
$edncDir = "C:\Enrollment\shopfloor-setup\Standard\eDNC"
|
$edncDir = "C:\Enrollment\shopfloor-setup\Standard\eDNC"
|
||||||
|
|
||||||
if (-not (Test-Path $edncDir)) {
|
if (-not (Test-Path $edncDir)) {
|
||||||
Write-Warning "eDNC folder not found at $edncDir — skipping."
|
Write-Warning "eDNC folder not found at $edncDir - skipping."
|
||||||
exit 0
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
@echo off
|
@echo off
|
||||||
REM Set-MachineNumber.bat — Wrapper for Set-MachineNumber.ps1
|
REM Set-MachineNumber.bat - Wrapper for Set-MachineNumber.ps1
|
||||||
REM Runs the PowerShell helper with bypass execution policy so a double-click
|
REM Runs the PowerShell helper with bypass execution policy so a double-click
|
||||||
REM from the desktop just works.
|
REM from the desktop just works.
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Set-MachineNumber.ps1 — Update UDC + eDNC machine number on a Standard shopfloor PC
|
# Set-MachineNumber.ps1 - Update UDC + eDNC machine number on a Standard shopfloor PC
|
||||||
#
|
#
|
||||||
# Purpose:
|
# Purpose:
|
||||||
# Both UDC and eDNC use the same per-machine identifier ("Workstation Number" /
|
# Both UDC and eDNC use the same per-machine identifier ("Workstation Number" /
|
||||||
@@ -135,7 +135,7 @@ if (Test-Path $udcExePath) {
|
|||||||
$summary = ($results -join "`n") + "`n`nTo apply eDNC changes, restart any running DncMain.exe."
|
$summary = ($results -join "`n") + "`n`nTo apply eDNC changes, restart any running DncMain.exe."
|
||||||
[System.Windows.Forms.MessageBox]::Show(
|
[System.Windows.Forms.MessageBox]::Show(
|
||||||
$summary,
|
$summary,
|
||||||
"Set Machine Number — Done",
|
"Set Machine Number - Done",
|
||||||
[System.Windows.Forms.MessageBoxButtons]::OK,
|
[System.Windows.Forms.MessageBoxButtons]::OK,
|
||||||
[System.Windows.Forms.MessageBoxIcon]::Information
|
[System.Windows.Forms.MessageBoxIcon]::Information
|
||||||
) | Out-Null
|
) | Out-Null
|
||||||
|
|||||||
Reference in New Issue
Block a user