Files
pxe-server/playbook/shopfloor-setup/Standard/Backup-UDCData.bat
cproudlock e169f8d0f5 Standard-Machine: UDC backup/restore use ArchivedData (not ArchiveData)
UDC's per-bay archive directory is C:\ProgramData\UDC\ArchivedData, not
ArchiveData. The previous spelling was a typo introduced when the scripts
were first written; it would have meant Backup-UDCData.ps1 found no archive
content (silent zero-file backups), and Restore-UDCData.ps1 wrote into a
location UDC does not read from.

Path swap is straight string replacement across both scripts plus the .bat
wrapper's usage comment. Manifest field names in backup.manifest.json /
restore.manifest.json (ArchivedDataPresent, ArchivedDataFiles,
ArchivedDataBytes) updated to match.

Update-MachineNumber.ps1's parallel UDC-restore branch (still uncommitted
in a prior workstream) has the same fix in the working tree, captured in
that branch's eventual commit.

The v2 share-staged copy at tsgwp00525-v2\standard-machine\scripts\
Restore-UDCData.ps1 also got the fix and is ready for push.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 11:45:39 -04:00

48 lines
1.6 KiB
Batchfile

@echo off
REM Backup-UDCData.bat - Tech-runnable wrapper for Backup-UDCData.ps1.
REM
REM Self-elevates via UAC so the script can read C:\ProgramData\UDC\* and
REM write to the SFLD share with the right cached creds. Forwards any
REM extra args verbatim (e.g. -KeepPriorBackup, -MachineNumber 7605).
REM
REM Usage on the OLD PC, before retirement:
REM 1. Double-click Backup-UDCData.bat (or right-click -> Run as admin)
REM 2. Approve the UAC prompt
REM 3. Watch the elevated PS window for the success summary
REM 4. Confirm \\tsgwp00525.wjs.geaerospace.net\shared\dt\shopfloor\backup\udc\<machine>\
REM now contains CurrentData.json + ArchivedData\ + backup.manifest.json
REM --- Self-elevate ---------------------------------------------------
net session >nul 2>&1
if %errorLevel% neq 0 (
echo Requesting admin rights...
powershell -Command "Start-Process '%~f0' -Verb RunAs -ArgumentList '%*'"
exit /b
)
set "SCRIPT=%~dp0Backup-UDCData.ps1"
if not exist "%SCRIPT%" (
echo ERROR: %SCRIPT% not found.
echo This .bat must be in the same folder as Backup-UDCData.ps1.
pause
exit /b 1
)
echo ============================================================
echo UDC Data Backup
echo ============================================================
echo Script: %SCRIPT%
echo.
PowerShell.exe -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT%" %*
set RC=%errorLevel%
echo.
echo ============================================================
echo Backup script exit code: %RC%
echo ============================================================
echo.
pause
exit /b %RC%