CMM: per-bay path is goCMM "Selected Part Group" UNC, not Shared Data Directory
A capture from a working CMM4 bay showed the goCMM registry holds two
distinct values under HKLM\SOFTWARE\WOW6432Node\General Electric\goCMM:
Shared Data Directory = C:\geaofi\ (constant on every bay)
Selected Part Group = \\tsgwp00525...\SHARED\... (the per-bay UNC path)
The prior commit (f6d970c) put the per-bay path into "Shared Data Directory",
which is wrong. Correct that:
- bay-config column shared_data_dir -> part_group
- resolve-cmm-bay-config emits partgroup.txt (was shareddatadir.txt)
- 09-Setup-CMM seeds "Shared Data Directory" to the constant C:\geaofi\ and
"Selected Part Group" to the per-bay path, converting the friendly S:\...
form to the \\tsgwp00525.wjs.geaerospace.net\SHARED UNC at apply time.
Users write grant on the key is unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -238,30 +238,42 @@ foreach ($exe in $pcdmisExes) {
|
||||
}
|
||||
|
||||
# ============================================================================
|
||||
# Step 2.7: Seed goCMM Shared Data Directory + grant Users write on the key
|
||||
# Step 2.7: Seed goCMM registry path values + grant Users write on the key
|
||||
# ============================================================================
|
||||
# goCMM (.NET x86 WPF app) stores its program-source path in the registry at
|
||||
# HKLM\SOFTWARE\WOW6432Node\General Electric\goCMM, value "Shared Data
|
||||
# Directory" (the folder it browses for *.prg PC-DMIS measurement routines).
|
||||
# It is a 32-bit MSI / 32-bit process, so both the install seed and runtime
|
||||
# reads land in the WOW6432Node view. Because the value lives in HKLM, a
|
||||
# non-admin shopfloor user cannot set it via goCMM's settings UI - and cannot
|
||||
# save a "Selected Part Group" switch either (same key). So we do two things
|
||||
# here in admin context:
|
||||
# 1. Seed "Shared Data Directory" to the per-bay path resolved by
|
||||
# resolve-cmm-bay-config.ps1 (C:\Enrollment\cmm\shareddatadir.txt).
|
||||
# 2. Grant BUILTIN\Users write on the key so runtime writes (part-group
|
||||
# switching, or a deliberate path change) succeed without elevation.
|
||||
# This mirrors Step 2.5, which grants Users Modify on the install dirs.
|
||||
# goCMM (.NET x86 WPF app) stores its config in the registry at
|
||||
# HKLM\SOFTWARE\WOW6432Node\General Electric\goCMM (32-bit MSI / 32-bit
|
||||
# process, so install seed and runtime reads both land in the WOW6432Node
|
||||
# view). A capture from a working CMM4 bay shows the two values that matter:
|
||||
# Shared Data Directory = C:\geaofi\ (constant)
|
||||
# Selected Part Group = \\tsgwp00525.wjs.geaerospace.net\SHARED\CMM\CMM4\Spool (per-bay UNC)
|
||||
# i.e. the PER-BAY program path is "Selected Part Group" (a UNC to the
|
||||
# tsgwp00525 SHARED share), and "Shared Data Directory" is the constant local
|
||||
# C:\geaofi\. Both live in HKLM, so a non-admin shopfloor user cannot set
|
||||
# them (nor save a part-group switch) without elevation. So in admin context
|
||||
# we: seed both values, and grant BUILTIN\Users write on the key so runtime
|
||||
# switches succeed without UAC. Mirrors Step 2.5 (install-dir ACL grant).
|
||||
$goCmmKey = 'HKLM:\SOFTWARE\WOW6432Node\General Electric\goCMM'
|
||||
|
||||
# Path may contain internal spaces (e.g. CMM8 "Venture CMM8"). Get-Content
|
||||
# + Trim keeps internal spaces; the value is passed as a single -Value arg,
|
||||
# Constant local data dir on every bay.
|
||||
$goCmmDataDir = 'C:\geaofi\'
|
||||
|
||||
# Host that S: maps to. Selected Part Group is stored as a UNC to this host's
|
||||
# SHARED share. Kept in one place so a domain/host change is a one-line edit.
|
||||
$partGroupShareRoot = '\\tsgwp00525.wjs.geaerospace.net\SHARED'
|
||||
|
||||
# Per-bay part group, resolved by resolve-cmm-bay-config.ps1 into
|
||||
# C:\Enrollment\cmm\partgroup.txt as a friendly S:\... path. Convert the S:
|
||||
# drive prefix to the UNC share root. Get-Content + Trim keeps internal spaces
|
||||
# (e.g. CMM8 "Venture CMM8"); the value is passed as a single -Value arg,
|
||||
# never through a command line, so the space cannot split the path.
|
||||
$sharedDataDir = ''
|
||||
$sddFile = 'C:\Enrollment\cmm\shareddatadir.txt'
|
||||
if (Test-Path -LiteralPath $sddFile) {
|
||||
$sharedDataDir = (Get-Content -LiteralPath $sddFile -First 1 -EA 0).Trim()
|
||||
$partGroup = ''
|
||||
$pgFile = 'C:\Enrollment\cmm\partgroup.txt'
|
||||
if (Test-Path -LiteralPath $pgFile) {
|
||||
$raw = (Get-Content -LiteralPath $pgFile -First 1 -EA 0).Trim()
|
||||
if ($raw) {
|
||||
# ^S:\ -> \\host\SHARED\ (case-insensitive). Leave non-S: values as-is.
|
||||
$partGroup = $raw -replace '(?i)^S:\\', "$partGroupShareRoot\"
|
||||
}
|
||||
}
|
||||
|
||||
if (-not (Test-Path $goCmmKey)) {
|
||||
@@ -269,15 +281,24 @@ if (-not (Test-Path $goCmmKey)) {
|
||||
try { New-Item -Path $goCmmKey -Force | Out-Null } catch { Write-CMMLog "Could not create $goCmmKey : $_" 'WARN' }
|
||||
}
|
||||
|
||||
if ($sharedDataDir) {
|
||||
# Shared Data Directory (constant)
|
||||
try {
|
||||
New-ItemProperty -Path $goCmmKey -Name 'Shared Data Directory' -Value $goCmmDataDir -PropertyType String -Force | Out-Null
|
||||
Write-CMMLog "Set goCMM 'Shared Data Directory' = $goCmmDataDir"
|
||||
} catch {
|
||||
Write-CMMLog "Failed to set goCMM 'Shared Data Directory': $_" 'WARN'
|
||||
}
|
||||
|
||||
# Selected Part Group (per-bay UNC)
|
||||
if ($partGroup) {
|
||||
try {
|
||||
New-ItemProperty -Path $goCmmKey -Name 'Shared Data Directory' -Value $sharedDataDir -PropertyType String -Force | Out-Null
|
||||
Write-CMMLog "Set goCMM 'Shared Data Directory' = $sharedDataDir"
|
||||
New-ItemProperty -Path $goCmmKey -Name 'Selected Part Group' -Value $partGroup -PropertyType String -Force | Out-Null
|
||||
Write-CMMLog "Set goCMM 'Selected Part Group' = $partGroup"
|
||||
} catch {
|
||||
Write-CMMLog "Failed to set goCMM 'Shared Data Directory': $_" 'WARN'
|
||||
Write-CMMLog "Failed to set goCMM 'Selected Part Group': $_" 'WARN'
|
||||
}
|
||||
} else {
|
||||
Write-CMMLog "No shareddatadir.txt (bay not in bay-config, or manual CMM ID) - leaving goCMM path unset" 'WARN'
|
||||
Write-CMMLog "No partgroup.txt (bay not in bay-config, or manual CMM ID) - leaving 'Selected Part Group' unset" 'WARN'
|
||||
}
|
||||
|
||||
# Grant BUILTIN\Users ReadKey+WriteKey (WriteKey = SetValue + CreateSubKey).
|
||||
|
||||
Reference in New Issue
Block a user