Files
pxe-server/playbook/shopfloor-setup/gea-shopfloor-cmm/Register-PCDMIS-COM.bat
cproudlock bc89ba1cf3 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>
2026-06-17 17:10:44 -04:00

58 lines
2.0 KiB
Batchfile

@echo off
REM ============================================================================
REM Register-PCDMIS-COM.bat - register the PC-DMIS COM / automation server.
REM
REM WHY: goCMM connects to PC-DMIS over COM. If the COM server is not
REM registered, goCMM throws "Object reference not set to an instance of an
REM object" at startup (it calls Type.GetTypeFromProgID on the PC-DMIS ProgID,
REM gets null, then Activator.CreateInstance(null) -> ArgumentNullException).
REM
REM IMPORTANT: PC-DMIS must be LICENSED FIRST. /regserver does NOT register the
REM COM server until a valid license is present. Activate the license with
REM clmadmin.exe, THEN run this. Safe to re-run any time goCMM stops connecting.
REM
REM Needs admin - this script self-elevates via UAC.
REM ============================================================================
REM --- self-elevate if not already running as admin ---
net session >nul 2>&1
if %errorlevel% neq 0 (
echo Requesting administrator rights...
powershell -NoProfile -Command "Start-Process -FilePath '%~f0' -Verb RunAs"
exit /b
)
echo ================================================================
echo Register PC-DMIS COM server (run AFTER licensing PC-DMIS)
echo ================================================================
echo.
setlocal enabledelayedexpansion
set "FOUND="
for %%D in (
"C:\Program Files\Hexagon"
"C:\Program Files (x86)\Hexagon"
"C:\Program Files\WAI"
"C:\Program Files (x86)\WAI"
) do (
if exist %%~D (
for /f "delims=" %%F in ('dir /b /s "%%~D\Pcdlrn.exe" 2^>nul') do (
set "FOUND=1"
echo Registering: %%F
"%%F" /regserver
if !errorlevel! equ 0 (echo OK) else (echo regserver returned !errorlevel!)
)
)
)
echo.
if not defined FOUND (
echo ERROR: Pcdlrn.exe not found. Is PC-DMIS installed?
) else (
echo Done.
echo If goCMM still errors, confirm PC-DMIS is LICENSED ^(clmadmin.exe^) and
echo that you ran this AFTER activating the license, then re-run.
)
echo.
pause