Update win-LKGC.ps1 to 1.3.1 - #137
Conversation
v1.3: [Aug 2026] - Aligns disk collision handling with the latest SAC repair path.
Preserves the attached source disk identity, temporarily changes only the
disposable repair OS disk for matching Gen2 GPT collisions, and restores
and verifies every temporary identity before reporting success.
v1.2.2: [Aug 2026] - Selects the existing LastKnownGood control set instead of incrementing
Select values and treats the absence of an alternate LKGC as a safe no-op.
Validates referenced control sets and their core Control and Services trees.
Prevents 0xc0000225 from missing or incomplete ControlSet references.
Adds logger-compatible JSON telemetry, SYSTEM hive backup, post-write
verification, unload retries, and backup rollback after failed writes.
Rejects invalid zero or negative boot control-set references before writes
and retries stale offline-hive cleanup before loading each SYSTEM hive.
Adds SAC-aligned repair-context detection, repair-disk exclusion, unlettered
Windows partition discovery, temporary drive assignment, and cleanup.
v1.2.1: [Aug 2026] - Added structured VMRepair telemetry for LKGC restoration.
Update [Jul 2026] - Partition Architecture Alignment: Refactored the core disk processing
loop to group by DiskNumber and map drive properties exactly like the
validated sac-enabler.ps1 framework.
v1.2: [May - Jul 2026] - Production Hardening & Handle Updates
|
Hi Gabriela Limoli (@glimoli) , Ryan McCallum (@rymccall) , Edwin Bernal Microsoft (@EdwinBernal1) , commit cca6790 on this PR, addresses all the latest feedback not yet implemented. I've also tested it on my side and works well. If possible, please test it and let's see if we can go live with v1.3. Thanks you! =========================
|
VMRepair Script Testing Results —
|
| Metric | Result |
|---|---|
| Overall Score | C (60/100) |
| Execution Success | 4/4 VMs passed (100% of provisioned) |
| Code Quality | B (84/100) — 0 errors, 0 warnings, 16 info |
| Telemetry Coverage | 33.7% — 1/12 catch blocks, 1/15 resolution paths instrumented |
Test Matrix
| Configuration | OS | Gen | VM Size | Breaker | Repair | After-State |
|---|---|---|---|---|---|---|
| Modern Standard | Win2022 | V2 | D2s_v3 | ✅ Injected | exit 0 | ✅ FIXED |
| Encrypted Modern | Win2019 | V2 | D2s_v3 | ✅ Injected | exit 0 | ✅ FIXED |
| Cost-Optimized | Win2022 | V2 | A2_v2 | ✅ Injected | exit 0 | ✅ FIXED |
| Mid-Tier 2016 | Win2016 | V1 | D2s_v3 | ✅ Injected | exit 0 | ✅ FIXED |
| Legacy Gen1 | — | — | — | — | SKIPPED | |
| Latest Gen2 + Premium | — | — | — | — | SKIPPED |
All 4 provisioned VMs had the LKGCNeeded fault injected (Current=1, Default=1, Failed=0, LKG=2) and the repair script successfully switched boot to ControlSet002.
Fault Injection Validation
BEFORE (breaker): Current=1, Default=1, Failed=0, LKG=2
AFTER (repair): Current=2, Default=2, Failed=1, LKG=2
Result: SCRIPT FINISHED PROPERLY, CHANGES_APPLIED=TRUE
Telemetry Gap Analysis
The script has a well-designed Write-LkgcTelemetry function, but only 7 of 22 required emission points are instrumented:
- 10/12 catch blocks use
Log-Erroronly (no structured telemetry) — root-cause data invisible to App Insights - 14/15 resolution-path branches log decisions via
Log-Info/Log-Warningbut don't emit telemetry — can't query which code path fired
A telemetry-enhanced reference implementation (all 15 additions, +86 lines) has been attached to the SME WI.
Recommendations
- Telemetry — Add
Write-LkgcTelemetrywithRootCauseproperty to uninstrumented catch blocks andResolutionPathproperty to decision branches - Test coverage — Test
NoAlternateLKGC(LKG=Current, no-op) andMissingControlSet(LKG=3, invalid ref) scenarios - Gen1 coverage — Validate MBR collision path with a Gen1 VM
Artifacts
Full test report, improvements document, and telemetry reference script attached to Azure-VM-POD WI #64443.
Generated by VMRepairMint Testing Framework
|
Hi Gabriela Limoli (@glimoli) , the latest commit aee2d6e addresses the latest feedback. Let's see if we get a higher score to go live with v1.3.1. Thanks |
v1.3: [Aug 2026] - Aligns disk collision handling with the latest SAC repair path.
Preserves the attached source disk identity, temporarily changes only the
disposable repair OS disk for matching Gen2 GPT collisions, and restores
and verifies every temporary identity before reporting success.
v1.2.2: [Aug 2026] - Selects the existing LastKnownGood control set instead of incrementing
Select values and treats the absence of an alternate LKGC as a safe no-op.
Validates referenced control sets and their core Control and Services trees.
Prevents 0xc0000225 from missing or incomplete ControlSet references.
Adds logger-compatible JSON telemetry, SYSTEM hive backup, post-write
verification, unload retries, and backup rollback after failed writes.
Rejects invalid zero or negative boot control-set references before writes
and retries stale offline-hive cleanup before loading each SYSTEM hive.
Adds SAC-aligned repair-context detection, repair-disk exclusion, unlettered
Windows partition discovery, temporary drive assignment, and cleanup.
v1.2.1: [Aug 2026] - Added structured VMRepair telemetry for LKGC restoration.
Update [Jul 2026] - Partition Architecture Alignment: Refactored the core disk processing
loop to group by DiskNumber and map drive properties exactly like the
validated sac-enabler.ps1 framework.
v1.2: [May - Jul 2026] - Production Hardening & Handle Updates