CMM: create C:\GE PC-DMIS FRONT END at imaging + move regserver helper to Public desktop

- Ensure-PCDMISFrontEnd.ps1/.bat: standalone fix for already-imaged bays -
  create C:\GE PC-DMIS FRONT END + grant Users/Auth Users Modify. PCDToIGES.exe
  writes its error log there in its catch block; on a fresh bay the dir is absent
  (legacy front-end setup isn't part of imaging), so ANY PCDToIGES error becomes
  an unhandled DirectoryNotFoundException that crashes the export and masks the
  real cause (confirmed live on a CMM bay).
- 09-Setup-CMM Step 2.5b: create that dir + ACL at imaging for every CMM bay.
- 09-Setup-CMM Step 2.5: Register-PCDMIS-COM.bat now lands on the Public desktop
  (visible to operator or SupportUser) instead of SupportUser-only.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-06-18 11:56:00 -04:00
parent 99deaa6882
commit 132c57ab39
3 changed files with 97 additions and 15 deletions

View File

@@ -175,6 +175,24 @@ foreach ($dir in $pcdmisDirs) {
}
}
# ============================================================================
# Step 2.5b: GE PC-DMIS FRONT END dir (PCDToIGES.exe error-log path)
# ============================================================================
# PCDToIGES.exe (in every bay's C:\geaofi\Scripts) writes its error log to
# C:\GE PC-DMIS FRONT END\PCDToIGES.ERR inside its catch block. The legacy
# "GE PC-DMIS FRONT END" front-end setup that created this dir is not part of
# imaging, so on a fresh bay it is absent - and then ANY PCDToIGES failure
# becomes an unhandled DirectoryNotFoundException that crashes the export and
# MASKS the real error. Create it + grant the operator Modify so errors log.
$frontEnd = 'C:\GE PC-DMIS FRONT END'
try {
if (-not (Test-Path -LiteralPath $frontEnd)) { New-Item -ItemType Directory -Path $frontEnd -Force | Out-Null; Write-CMMLog "Created $frontEnd" }
foreach ($sid in '*S-1-5-32-545','*S-1-5-11') { # BUILTIN\Users, NT AUTHORITY\Authenticated Users
& icacls "$frontEnd" /grant "${sid}:(OI)(CI)M" /T /C 2>&1 | Out-Null
}
Write-CMMLog "Granted Users + Authenticated Users Modify on $frontEnd"
} catch { Write-CMMLog "Failed to ensure ${frontEnd}: $_" "WARN" }
# ============================================================================
# Step 2.6: First-run-as-admin for each installed PC-DMIS version
# ============================================================================
@@ -315,27 +333,23 @@ if (Test-Path -LiteralPath $restoreScript) {
}
# ============================================================================
# Step 2.5: drop Register-PCDMIS-COM.bat on the SupportUser desktop
# Step 2.5: drop Register-PCDMIS-COM.bat on the Public 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.
# tech runs AFTER activating the license. Public Desktop so it is visible to
# whoever logs in (operator or SupportUser). NOTE: 06-OrganizeDesktop sweeps the
# Public Desktop root into category subfolders, so it may end up under
# "Shopfloor Tools" rather than the bare desktop - still on the Public desktop.
$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' }
}
$d = 'C:\Users\Public\Desktop'
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'
}