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
|
# goCMM (.NET x86 WPF app) stores its config in the registry at
|
||||||
# HKLM\SOFTWARE\WOW6432Node\General Electric\goCMM, value "Shared Data
|
# HKLM\SOFTWARE\WOW6432Node\General Electric\goCMM (32-bit MSI / 32-bit
|
||||||
# Directory" (the folder it browses for *.prg PC-DMIS measurement routines).
|
# process, so install seed and runtime reads both land in the WOW6432Node
|
||||||
# It is a 32-bit MSI / 32-bit process, so both the install seed and runtime
|
# view). A capture from a working CMM4 bay shows the two values that matter:
|
||||||
# reads land in the WOW6432Node view. Because the value lives in HKLM, a
|
# Shared Data Directory = C:\geaofi\ (constant)
|
||||||
# non-admin shopfloor user cannot set it via goCMM's settings UI - and cannot
|
# Selected Part Group = \\tsgwp00525.wjs.geaerospace.net\SHARED\CMM\CMM4\Spool (per-bay UNC)
|
||||||
# save a "Selected Part Group" switch either (same key). So we do two things
|
# i.e. the PER-BAY program path is "Selected Part Group" (a UNC to the
|
||||||
# here in admin context:
|
# tsgwp00525 SHARED share), and "Shared Data Directory" is the constant local
|
||||||
# 1. Seed "Shared Data Directory" to the per-bay path resolved by
|
# C:\geaofi\. Both live in HKLM, so a non-admin shopfloor user cannot set
|
||||||
# resolve-cmm-bay-config.ps1 (C:\Enrollment\cmm\shareddatadir.txt).
|
# them (nor save a part-group switch) without elevation. So in admin context
|
||||||
# 2. Grant BUILTIN\Users write on the key so runtime writes (part-group
|
# we: seed both values, and grant BUILTIN\Users write on the key so runtime
|
||||||
# switching, or a deliberate path change) succeed without elevation.
|
# switches succeed without UAC. Mirrors Step 2.5 (install-dir ACL grant).
|
||||||
# This mirrors Step 2.5, which grants Users Modify on the install dirs.
|
|
||||||
$goCmmKey = 'HKLM:\SOFTWARE\WOW6432Node\General Electric\goCMM'
|
$goCmmKey = 'HKLM:\SOFTWARE\WOW6432Node\General Electric\goCMM'
|
||||||
|
|
||||||
# Path may contain internal spaces (e.g. CMM8 "Venture CMM8"). Get-Content
|
# Constant local data dir on every bay.
|
||||||
# + Trim keeps internal spaces; the value is passed as a single -Value arg,
|
$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.
|
# never through a command line, so the space cannot split the path.
|
||||||
$sharedDataDir = ''
|
$partGroup = ''
|
||||||
$sddFile = 'C:\Enrollment\cmm\shareddatadir.txt'
|
$pgFile = 'C:\Enrollment\cmm\partgroup.txt'
|
||||||
if (Test-Path -LiteralPath $sddFile) {
|
if (Test-Path -LiteralPath $pgFile) {
|
||||||
$sharedDataDir = (Get-Content -LiteralPath $sddFile -First 1 -EA 0).Trim()
|
$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)) {
|
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' }
|
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 {
|
try {
|
||||||
New-ItemProperty -Path $goCmmKey -Name 'Shared Data Directory' -Value $sharedDataDir -PropertyType String -Force | Out-Null
|
New-ItemProperty -Path $goCmmKey -Name 'Selected Part Group' -Value $partGroup -PropertyType String -Force | Out-Null
|
||||||
Write-CMMLog "Set goCMM 'Shared Data Directory' = $sharedDataDir"
|
Write-CMMLog "Set goCMM 'Selected Part Group' = $partGroup"
|
||||||
} catch {
|
} catch {
|
||||||
Write-CMMLog "Failed to set goCMM 'Shared Data Directory': $_" 'WARN'
|
Write-CMMLog "Failed to set goCMM 'Selected Part Group': $_" 'WARN'
|
||||||
}
|
}
|
||||||
} else {
|
} 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).
|
# Grant BUILTIN\Users ReadKey+WriteKey (WriteKey = SetValue + CreateSubKey).
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
cmm_id,pcdmis_version,doda,shared_data_dir
|
cmm_id,pcdmis_version,doda,part_group
|
||||||
CMM1,2019,no,S:\CMM\CMM1\HPTCMM1
|
CMM1,2019,no,S:\CMM\CMM1\HPTCMM1
|
||||||
CMM2,2019,no,S:\CMM\CMM2\HPT
|
CMM2,2019,no,S:\CMM\CMM2\HPT
|
||||||
CMM3,2019,no,S:\CMM\CMM3\VENTURE_CMM3
|
CMM3,2019,no,S:\CMM\CMM3\VENTURE_CMM3
|
||||||
|
|||||||
|
@@ -40,21 +40,23 @@ if (-not (Test-Path $OutDir)) {
|
|||||||
|
|
||||||
$version = $match.pcdmis_version.Trim()
|
$version = $match.pcdmis_version.Trim()
|
||||||
$doda = $match.doda.Trim().ToLower()
|
$doda = $match.doda.Trim().ToLower()
|
||||||
# shared_data_dir may legitimately contain spaces (e.g. CMM8 "Venture CMM8").
|
# part_group is the goCMM "Selected Part Group" path. It may legitimately
|
||||||
# Trim() strips only leading/trailing whitespace, never internal spaces.
|
# contain spaces (e.g. CMM8 "Venture CMM8"); Trim() strips only leading/
|
||||||
$sharedDataDir = ''
|
# trailing whitespace, never internal spaces. Stored in the friendly S:\
|
||||||
if ($match.PSObject.Properties['shared_data_dir'] -and $match.shared_data_dir) {
|
# form; 09-Setup-CMM converts it to the tsgwp00525 UNC at apply time.
|
||||||
$sharedDataDir = $match.shared_data_dir.Trim()
|
$partGroup = ''
|
||||||
|
if ($match.PSObject.Properties['part_group'] -and $match.part_group) {
|
||||||
|
$partGroup = $match.part_group.Trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.IO.File]::WriteAllText((Join-Path $OutDir 'version.txt'), $version)
|
[System.IO.File]::WriteAllText((Join-Path $OutDir 'version.txt'), $version)
|
||||||
[System.IO.File]::WriteAllText((Join-Path $OutDir 'doda.txt'), $doda)
|
[System.IO.File]::WriteAllText((Join-Path $OutDir 'doda.txt'), $doda)
|
||||||
if ($sharedDataDir) {
|
if ($partGroup) {
|
||||||
[System.IO.File]::WriteAllText((Join-Path $OutDir 'shareddatadir.txt'), $sharedDataDir)
|
[System.IO.File]::WriteAllText((Join-Path $OutDir 'partgroup.txt'), $partGroup)
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Resolved $CmmId -> PC-DMIS $version, DODA=$doda, SharedDataDir=$(if ($sharedDataDir) { $sharedDataDir } else { '(none)' })"
|
Write-Host "Resolved $CmmId -> PC-DMIS $version, DODA=$doda, PartGroup=$(if ($partGroup) { $partGroup } else { '(none)' })"
|
||||||
Write-Host " version.txt -> $OutDir\version.txt"
|
Write-Host " version.txt -> $OutDir\version.txt"
|
||||||
Write-Host " doda.txt -> $OutDir\doda.txt"
|
Write-Host " doda.txt -> $OutDir\doda.txt"
|
||||||
if ($sharedDataDir) { Write-Host " shareddatadir.txt -> $OutDir\shareddatadir.txt" }
|
if ($partGroup) { Write-Host " partgroup.txt -> $OutDir\partgroup.txt" }
|
||||||
exit 0
|
exit 0
|
||||||
|
|||||||
Reference in New Issue
Block a user