CMM: add Register-PCDMIS-COM.bat desktop helper for post-license COM regserver

PC-DMIS COM must be registered for goCMM to connect, but Pcdlrn.exe /regserver
no-ops until PC-DMIS is licensed - which is a manual post-image step
(clmadmin.exe). So we cannot register at imaging time. Instead 09-Setup-CMM
drops a self-elevating one-click helper on the SupportUser desktop (a
pre-existing profile; avoids 06-OrganizeDesktop's Public-desktop sweep). The
tech runs it after activating the license; safe to re-run. Falls back to Public
Desktop if the SupportUser profile is absent. Copy happens before the Step 3
staging cleanup.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-06-17 17:10:44 -04:00
parent 1487abdba5
commit bc89ba1cf3
2 changed files with 83 additions and 0 deletions

View File

@@ -314,6 +314,32 @@ if (Test-Path -LiteralPath $restoreScript) {
Write-CMMLog "Restore-CMM.ps1 not found at $restoreScript - skipping settings restore" 'WARN'
}
# ============================================================================
# Step 2.5: drop Register-PCDMIS-COM.bat on the SupportUser desktop
# ============================================================================
# PC-DMIS COM must be registered for goCMM to connect, but /regserver no-ops
# until PC-DMIS is licensed - which happens manually post-image (clmadmin.exe).
# So we cannot register at imaging time; instead leave a one-click helper the
# tech runs AFTER activating the license. SupportUser is a pre-existing profile
# (see 03-ShellDefaults), so its Desktop exists now. Public Desktop would get
# reorganized by 06-OrganizeDesktop's sweep, so target SupportUser directly;
# fall back to Public Desktop only if the SupportUser profile is absent.
$regBat = Join-Path $stagingRoot 'Register-PCDMIS-COM.bat'
if (Test-Path -LiteralPath $regBat) {
$deskTargets = @()
if (Test-Path 'C:\Users\SupportUser') { $deskTargets += 'C:\Users\SupportUser\Desktop' }
else { $deskTargets += 'C:\Users\Public\Desktop' }
foreach ($d in $deskTargets) {
try {
if (-not (Test-Path $d)) { New-Item -Path $d -ItemType Directory -Force | Out-Null }
Copy-Item -LiteralPath $regBat -Destination (Join-Path $d 'Register-PCDMIS-COM.bat') -Force
Write-CMMLog "Staged Register-PCDMIS-COM.bat -> $d"
} catch { Write-CMMLog "Failed to stage Register-PCDMIS-COM.bat to ${d}: $_" 'WARN' }
}
} else {
Write-CMMLog "Register-PCDMIS-COM.bat not in staging ($regBat) - desktop helper NOT placed" 'WARN'
}
# ============================================================================
# Step 3: Conditional cleanup of the bootstrap staging dir
# ============================================================================