diff --git a/playbook/shopfloor-setup/gea-shopfloor-waxtrace/scripts/Export-FormtracepakInventory.ps1 b/playbook/shopfloor-setup/gea-shopfloor-waxtrace/scripts/Export-FormtracepakInventory.ps1 index 088d53d..a50bfb7 100755 --- a/playbook/shopfloor-setup/gea-shopfloor-waxtrace/scripts/Export-FormtracepakInventory.ps1 +++ b/playbook/shopfloor-setup/gea-shopfloor-waxtrace/scripts/Export-FormtracepakInventory.ps1 @@ -291,8 +291,20 @@ foreach ($uPath in $uninstallPaths) { } } -# ---------------------------------------------------------------------- 5. Locate Running Processes / Services ---------------------------------------------------------------------- -Write-Host "[5/5] Checking running processes and services..." -ForegroundColor Cyan +# ---------------------------------------------------------------------- 5. Locate Running Processes ---------------------------------------------------------------------- +# +# Service enumeration was removed 2026-05-24. Get-Service was hanging +# indefinitely on West Jefferson wax/trace bays (WJF00052, WJF00083, +# WJF00084, WJF00159 were left with empty inventory CSVs because the +# operator killed the .bat after the apparent hang). The earlier +# Start-Job + Wait-Job -Timeout 30 fence was insufficient: Stop-Job on +# a Get-Service that's blocked on the Service Control Manager can itself +# block in the SCM call, so the main script never unblocked after the +# timeout fired. Service state is audit-nice-to-have, not load-bearing +# for identifying the install (version + model + DeviceName come from +# elsewhere), so the cleanest fix is to drop it entirely. Get-Process is +# fast and stays. +Write-Host "[5/5] Checking running processes..." -ForegroundColor Cyan $processPatterns = @('Formpak', 'Formtracepak', 'SurfPak', 'MtSurf', 'MtForm', 'Mitutoyo') foreach ($pp in $processPatterns) { @@ -304,38 +316,6 @@ foreach ($pp in $processPatterns) { } } -# Service enumeration. The original `Get-Service | Where-Object { DisplayName -match ... }` -# materializes every service via the Service Control Manager + post-filters -# in PowerShell and has been observed to hang for minutes on shopfloor PCs -# where the SCM or a single service is in a degraded state (Sentinel HASP -# driver / GE-Enforce agent service have both blocked Get-Service before). -# Replace with -DisplayName server-side wildcard filter (the SCM only -# materializes matching services) and wrap in a 30-second runspace fence so -# any further hang aborts gracefully without taking the whole script down. -$serviceJob = Start-Job -ScriptBlock { - Get-Service -DisplayName 'Mitutoyo*','*FORMTRACEPAK*','*FORMPAK*','*SURFPAK*' -ErrorAction SilentlyContinue | - ForEach-Object { - [PSCustomObject]@{ - Name = $_.Name - DisplayName = $_.DisplayName - Status = [string]$_.Status - } - } -} -$services = @() -if (Wait-Job -Job $serviceJob -Timeout 30) { - $services = @(Receive-Job -Job $serviceJob -ErrorAction SilentlyContinue) -} else { - Write-Warning " Service enumeration exceeded 30s timeout - skipping (SCM degraded?)" - Stop-Job -Job $serviceJob -ErrorAction SilentlyContinue -} -Remove-Job -Job $serviceJob -Force -ErrorAction SilentlyContinue -foreach ($svc in $services) { - Add-Item -Category 'Service' -ItemType 'Service' ` - -Path $svc.Name -Name $svc.DisplayName ` - -Value $svc.Status -} - # ---------------------------------------------------------------------- Output ---------------------------------------------------------------------- if (-not (Test-Path $OutputPath)) {