Skip to content

Commit e245bf4

Browse files
authored
Update
1 parent ca5d6bf commit e245bf4

1 file changed

Lines changed: 32 additions & 32 deletions

File tree

src/windows/sac-enabler.ps1

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,50 +20,50 @@
2020
Name: sac-enabler.ps1
2121
Author: Tony.Mocanu@Microsoft.com
2222
Last Modified: 2026-08-06
23-
Version: 1.6.1
23+
Version: 1.3
2424
Requirement: Azure repair VM with an attached Windows OS disk
2525
DeployMode: az vm repair run (with --run-on-repair)
2626
2727
.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.
5353
- Requires and verifies a BCD backup before applying SAC settings.
5454
- 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.
5656
- Added explicit winload.exe and winload.efi detection.
5757
- 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.
5959
- Uses Get-Disk-Partitions to enumerate Azure virtual disks.
6060
- Detects repair vs. standard context from secondary disks returned by the helper.
6161
- Mounts unlettered Gen2 Windows and EFI partitions temporarily.
6262
- Probes unlettered partitions directly instead of assuming GPT metadata or size.
6363
- Refuses BCD changes when a repair VM context is not detected.
6464
- Fails closed if the repair VM OS disk cannot be identified.
6565
- 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.
6767
- Detected rescue VM mode versus standard mode for context-aware error messages.
6868
- Logs to both the desktop and the plugin directory for automatic collection by az vm repair.
6969
- **NEW SAFETY: Pre-flight checks, BCD backup, and post-change verification.
@@ -487,7 +487,7 @@ function Log-Debug {
487487
}
488488

489489
# Structured telemetry is written through the existing dual-write logging path.
490-
$script:RepairScriptVersion = '1.6.1'
490+
$script:RepairScriptVersion = '1.3'
491491
$script:ExecutionStarted = Get-Date
492492
$script:OperationCount = 0
493493
$script:LastCommand = $null
@@ -707,15 +707,15 @@ $gptCollisionDiskNumbers = @()
707707
$repairDiskIdentityRecord = $null
708708

709709
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"
711711

712712
# VMRepairMint telemetry marker
713713
Log-Info "[script_start] Script=sac-enabler Version=$($script:RepairScriptVersion)"
714714

715715
Write-SacTelemetry -Event Start -Message 'script_start' -Properties @{
716716
ScriptName = 'sac-enabler.ps1'
717717
ScriptVersion = $script:RepairScriptVersion
718-
BuildMarker = 'v1.6.1-repair-unknown-loader-device'
718+
BuildMarker = 'v1.3-repair-unknown-loader-device'
719719
StartTimeUtc = (Get-Date).ToUniversalTime().ToString('o')
720720
}
721721

0 commit comments

Comments
 (0)