Shopfloor imaging: CMM type, Configure-PC override fix, serial drivers
- CMM imaging pipeline: WinPE-staged bootstrap + on-logon enforcer against tsgwp00525 share, manifest-driven installer runner shared via Install-FromManifest.ps1. Installs PC-DMIS 2016/2019 R2, CLM 1.8, goCMM; enables .NET 3.5 prereq; registers GE CMM Enforce logon task for ongoing version enforcement. - Shopfloor serial drivers: StarTech PCIe serial + Prolific PL2303 USB-to-serial via Install-Drivers.cmd wrapper calling pnputil /add-driver /subdirs /install. Scoped to Standard PCs. - OpenText extended to CMM/Keyence/Genspect/WaxAndTrace via preinstall.json PCTypes; Defect Tracker added to CMM profile desktopApps + taskbarPins. - Configure-PC startup-item toggle now persists across the logon sweep via C:\\ProgramData\\GE\\Shopfloor\\startup-overrides.json; 06-OrganizeDesktop Phase 3 respects suppressed items. - Get-ProfileValue helper added to Shopfloor/lib/Get-PCProfile.ps1; distinguishes explicit empty array from missing key (fixes Lab getting Plant Apps in startup because empty array was falsy). - 06-OrganizeDesktop gains transcript logging at C:\\Logs\\SFLD\\ 06-OrganizeDesktop.log and now deletes the stale Shopfloor Intune Sync task when C:\\Enrollment\\sync-complete.txt is present (task was registered with Limited principal and couldn't self-unregister). - startnet.cmd CMM xcopy block (gated on pc-type=CMM) stages the bundle to W:\\CMM-Install during WinPE. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -42,6 +42,31 @@ Write-Host "Running as: $([System.Security.Principal.WindowsIdentity]::GetCurren
|
||||
|
||||
$startupDir = 'C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup'
|
||||
$publicDesktop = 'C:\Users\Public\Desktop'
|
||||
$overridesPath = 'C:\ProgramData\GE\Shopfloor\startup-overrides.json'
|
||||
|
||||
# Persist user-toggled startup overrides so the logon-triggered sweep
|
||||
# (06-OrganizeDesktop.ps1 Phase 3) doesn't re-create .lnks the tech
|
||||
# explicitly removed. Labels in $suppressed are the ones currently OFF.
|
||||
function Get-SuppressedStartup {
|
||||
if (-not (Test-Path -LiteralPath $overridesPath)) { return @() }
|
||||
try {
|
||||
$data = Get-Content -LiteralPath $overridesPath -Raw | ConvertFrom-Json
|
||||
if ($data.suppressed) { return @($data.suppressed) }
|
||||
} catch {
|
||||
Write-Warning " Failed to parse $overridesPath : $_"
|
||||
}
|
||||
return @()
|
||||
}
|
||||
|
||||
function Set-SuppressedStartup {
|
||||
param([string[]]$Labels)
|
||||
$dir = Split-Path -Parent $overridesPath
|
||||
if (-not (Test-Path $dir)) {
|
||||
New-Item -ItemType Directory -Path $dir -Force | Out-Null
|
||||
}
|
||||
$payload = @{ suppressed = @($Labels | Sort-Object -Unique) }
|
||||
$payload | ConvertTo-Json | Set-Content -LiteralPath $overridesPath -Encoding UTF8
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# Helpers
|
||||
@@ -116,11 +141,9 @@ $edgePath = @(
|
||||
# Resolved from: pcProfile.startupItems > siteConfig.startupItems > hardcoded
|
||||
# ============================================================================
|
||||
|
||||
$cfgItems = if ($pcProfile -and $pcProfile.startupItems) { $pcProfile.startupItems }
|
||||
elseif ($siteConfig -and $siteConfig.startupItems) { $siteConfig.startupItems }
|
||||
else { $null }
|
||||
$cfgItems = Get-ProfileValue 'startupItems'
|
||||
|
||||
if ($cfgItems) {
|
||||
if ($null -ne $cfgItems -and $cfgItems.Count -gt 0) {
|
||||
$items = @()
|
||||
$num = 0
|
||||
foreach ($si in $cfgItems) {
|
||||
@@ -345,21 +368,38 @@ if ($selection) {
|
||||
$selected = $selection -split '[,\s]+' | Where-Object { $_ -match '^\d+$' } | ForEach-Object { [int]$_ }
|
||||
|
||||
# Process startup items 1-5
|
||||
$suppressed = @(Get-SuppressedStartup)
|
||||
$suppressedChanged = $false
|
||||
|
||||
foreach ($item in $items) {
|
||||
if ($selected -notcontains $item.Num) { continue }
|
||||
|
||||
if (-not $item.Available) {
|
||||
Write-Host " $($item.Label): not installed, skipping" -ForegroundColor DarkGray
|
||||
continue
|
||||
}
|
||||
|
||||
$existingLnk = Join-Path $startupDir "$($item.Label).lnk"
|
||||
if (Test-Path -LiteralPath $existingLnk) {
|
||||
# Toggling OFF: remove the .lnk AND record the suppression so
|
||||
# the logon sweep in 06-OrganizeDesktop doesn't re-create it.
|
||||
try {
|
||||
Remove-Item -LiteralPath $existingLnk -Force
|
||||
Write-Host " $($item.Label): REMOVED from startup" -ForegroundColor Yellow
|
||||
} catch { Write-Warning " Failed to remove $($item.Label): $_" }
|
||||
|
||||
if ($suppressed -notcontains $item.Label) {
|
||||
$suppressed += $item.Label
|
||||
$suppressedChanged = $true
|
||||
}
|
||||
} else {
|
||||
# Toggling ON: drop any suppression first so the sweep won't
|
||||
# fight us next logon, then create the .lnk.
|
||||
if ($suppressed -contains $item.Label) {
|
||||
$suppressed = @($suppressed | Where-Object { $_ -ne $item.Label })
|
||||
$suppressedChanged = $true
|
||||
}
|
||||
|
||||
if (-not $item.Available) {
|
||||
Write-Host " $($item.Label): not installed, cannot add to startup" -ForegroundColor DarkGray
|
||||
continue
|
||||
}
|
||||
|
||||
$result = & $item.CreateLnk
|
||||
if ($result) {
|
||||
Write-Host " $($item.Label): ADDED to startup" -ForegroundColor Green
|
||||
@@ -367,6 +407,15 @@ if ($selection) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($suppressedChanged) {
|
||||
try {
|
||||
Set-SuppressedStartup -Labels $suppressed
|
||||
Write-Host " (saved override state to $overridesPath)" -ForegroundColor DarkGray
|
||||
} catch {
|
||||
Write-Warning " Failed to write override state: $_"
|
||||
}
|
||||
}
|
||||
|
||||
# Process item 6: machine number logon task
|
||||
if ($selected -contains 6) {
|
||||
if ($machineNumTaskExists) {
|
||||
|
||||
Reference in New Issue
Block a user