|
20 | 20 | Name: sac-enabler.ps1 |
21 | 21 | Author: Tony.Mocanu@Microsoft.com |
22 | 22 | Last Modified: 2026-08-06 |
23 | | - Version: 1.6.1 |
| 23 | + Version: 1.3 |
24 | 24 | Requirement: Azure repair VM with an attached Windows OS disk |
25 | 25 | DeployMode: az vm repair run (with --run-on-repair) |
26 | 26 | |
27 | 27 | .VERSION |
28 | | - v1.6.1: [August 2026] - Repairs loader device/osdevice when they render as unknown. |
29 | | - - Writes the validated Windows partition while the source retains its original GPT identity. |
30 | | - - Re-queries and verifies the repaired loader mapping before enabling EMS. |
31 | | - v1.6.0: [August 2026] - Preserves the Gen2 source disk GPT GUID for the entire repair. |
32 | | - - Resolves a GPT collision by temporarily changing only the disposable repair VM OS disk GUID. |
33 | | - - Offlines the source disk before restoring and verifying the repair OS disk GUID. |
34 | | - v1.5.9: [August 2026] - Refuses to rewrite a collision-offlined GPT disk identity. |
35 | | - - Requires a non-colliding repair OS disk or matching-generation nested repair for Gen2. |
36 | | - v1.5.8: [August 2026] - Rebinds embedded BCD WMI results through their documented key properties. |
37 | | - - Avoids invalid ManagementBaseObject-to-ManagementObject casts. |
38 | | - v1.5.7: [August 2026] - Uses typed BCD WMI element setters instead of BCDEdit for writes. |
39 | | - - Prevents unrelated GPT device descriptors from being reserialized under a temporary identity. |
40 | | - v1.5.6: [August 2026] - Temporarily assigns a unique identity to collision-offlined attached disks. |
41 | | - - Restores and verifies the exact original disk identity before reporting success. |
42 | | - v1.5.5: [August 2026] - Refuses repair when an attached disk is offline due to an identity collision. |
43 | | - - Prevents onlining a colliding source disk and invalidating BCD device references. |
44 | | - v1.5.4: [August 2026] - Skips EMS writes for settings that are already correct. |
45 | | - - Logs the full verbose BCD store before and after changes. |
46 | | - v1.5.3: [August 2026] - Uses only the documented offline EMS and EMS settings commands. |
47 | | - - Does not enable the optional Windows boot menu or Boot Manager EMS. |
48 | | - v1.5.2: [August 2026] - Restores the verified BCD backup after any post-write failure. |
49 | | - - Preserves device and osdevice mappings without normalization. |
50 | | - v1.5.1: [August 2026] - Avoids comparing guest BCD drive letters with repair-VM mount letters. |
51 | | - - Uses VM generation when selecting the detected loader path for logging. |
52 | | - v1.5: [August 2026] - Validates loader mapping before BCD writes and verifies mapping invariance afterward. |
| 28 | + v1.3: [August 2026] - Repairs loader device/osdevice when they render as unknown. |
| 29 | + - Writes the validated Windows partition while the source retains its original GPT identity. |
| 30 | + - Re-queries and verifies the repaired loader mapping before enabling EMS. |
| 31 | + - Preserves the Gen2 source disk GPT GUID for the entire repair. |
| 32 | + - Resolves a GPT collision by temporarily changing only the disposable repair VM OS disk GUID. |
| 33 | + - Offlines the source disk before restoring and verifying the repair OS disk GUID. |
| 34 | + - Refuses to rewrite a collision-offlined GPT disk identity. |
| 35 | + - Requires a non-colliding repair OS disk or matching-generation nested repair for Gen2. |
| 36 | + - Rebinds embedded BCD WMI results through their documented key properties. |
| 37 | + - Avoids invalid ManagementBaseObject-to-ManagementObject casts. |
| 38 | + - Uses typed BCD WMI element setters instead of BCDEdit for writes. |
| 39 | + - Prevents unrelated GPT device descriptors from being reserialized under a temporary identity. |
| 40 | + - Temporarily assigns a unique identity to collision-offlined attached disks. |
| 41 | + - Restores and verifies the exact original disk identity before reporting success. |
| 42 | + - Refuses repair when an attached disk is offline due to an identity collision. |
| 43 | + - Prevents onlining a colliding source disk and invalidating BCD device references. |
| 44 | + - Skips EMS writes for settings that are already correct. |
| 45 | + - Logs the full verbose BCD store before and after changes. |
| 46 | + - Uses only the documented offline EMS and EMS settings commands. |
| 47 | + - Does not enable the optional Windows boot menu or Boot Manager EMS. |
| 48 | + - Restores the verified BCD backup after any post-write failure. |
| 49 | + - Preserves device and osdevice mappings without normalization. |
| 50 | + - Avoids comparing guest BCD drive letters with repair-VM mount letters. |
| 51 | + - Uses VM generation when selecting the detected loader path for logging. |
| 52 | + - Validates loader mapping before BCD writes and verifies mapping invariance afterward. |
53 | 53 | - Requires and verifies a BCD backup before applying SAC settings. |
54 | 54 | - Restores the backup if path, device, osdevice, or systemroot changes unexpectedly. |
55 | | - v1.4: [August 2026] - Added VMRepairMint telemetry, structured before-state capture, and Gen1/Gen2 discovery telemetry. |
| 55 | + - Added VMRepairMint telemetry, structured before-state capture, and Gen1/Gen2 discovery telemetry. |
56 | 56 | - Added explicit winload.exe and winload.efi detection. |
57 | 57 | - Added explicit displayorder and boot entry GUID failure diagnostics. |
58 | | - Update [July 2026] - Restricted execution to repair VM mode. |
| 58 | + - Restricted execution to repair VM mode. |
59 | 59 | - Uses Get-Disk-Partitions to enumerate Azure virtual disks. |
60 | 60 | - Detects repair vs. standard context from secondary disks returned by the helper. |
61 | 61 | - Mounts unlettered Gen2 Windows and EFI partitions temporarily. |
62 | 62 | - Probes unlettered partitions directly instead of assuming GPT metadata or size. |
63 | 63 | - Refuses BCD changes when a repair VM context is not detected. |
64 | 64 | - Fails closed if the repair VM OS disk cannot be identified. |
65 | 65 | - Filters out the repair VM OS disk before processing attached disks. |
66 | | - Update: [July 2026] - Added execution context detection and dual-logging. |
| 66 | + - Added execution context detection and dual-logging. |
67 | 67 | - Detected rescue VM mode versus standard mode for context-aware error messages. |
68 | 68 | - Logs to both the desktop and the plugin directory for automatic collection by az vm repair. |
69 | 69 | - **NEW SAFETY: Pre-flight checks, BCD backup, and post-change verification. |
@@ -487,7 +487,7 @@ function Log-Debug { |
487 | 487 | } |
488 | 488 |
|
489 | 489 | # Structured telemetry is written through the existing dual-write logging path. |
490 | | -$script:RepairScriptVersion = '1.6.1' |
| 490 | +$script:RepairScriptVersion = '1.3' |
491 | 491 | $script:ExecutionStarted = Get-Date |
492 | 492 | $script:OperationCount = 0 |
493 | 493 | $script:LastCommand = $null |
@@ -707,15 +707,15 @@ $gptCollisionDiskNumbers = @() |
707 | 707 | $repairDiskIdentityRecord = $null |
708 | 708 |
|
709 | 709 | Log-Info "Starting repair-only SAC enabler. Logs: $logFile" |
710 | | -Log-Info "Build marker: v1.6.1-repair-unknown-loader-device" |
| 710 | +Log-Info "Build marker: v1.3-repair-unknown-loader-device" |
711 | 711 |
|
712 | 712 | # VMRepairMint telemetry marker |
713 | 713 | Log-Info "[script_start] Script=sac-enabler Version=$($script:RepairScriptVersion)" |
714 | 714 |
|
715 | 715 | Write-SacTelemetry -Event Start -Message 'script_start' -Properties @{ |
716 | 716 | ScriptName = 'sac-enabler.ps1' |
717 | 717 | ScriptVersion = $script:RepairScriptVersion |
718 | | - BuildMarker = 'v1.6.1-repair-unknown-loader-device' |
| 718 | + BuildMarker = 'v1.3-repair-unknown-loader-device' |
719 | 719 | StartTimeUtc = (Get-Date).ToUniversalTime().ToString('o') |
720 | 720 | } |
721 | 721 |
|
|
0 commit comments