Skip to content

Update win-ignoreAllFailures.ps1 to v1.2#130

Open
anmocanu wants to merge 3 commits into
Azure:mainfrom
anmocanu:patch-13
Open

Update win-ignoreAllFailures.ps1 to v1.2#130
anmocanu wants to merge 3 commits into
Azure:mainfrom
anmocanu:patch-13

Conversation

@anmocanu

Copy link
Copy Markdown
Contributor

.VERSION
v1.2: [May 2026] - Updated the script (current)
- Added guarded nested VM handling to prevent Get-VM failures when Hyper-V module is unavailable.
- Switched partition discovery from inline CIM enumeration to shared Get-Disk-Partitions-v2 helper.
- Added .SYNOPSIS header and aligned metadata versioning/documentation with current script behavior.
v1.1: [Apr 2026] - Enhanced CIM logic for disk enumeration and partition discovery
v1.0: Initial commit - Sets BCD boot status policy to IgnoreAllFailures to break Automatic Repair loops

.VERSION
    v1.2: [May 2026] - Updated the script (current)
                       - Added guarded nested VM handling to prevent Get-VM failures when Hyper-V module is unavailable.
                       - Switched partition discovery from inline CIM enumeration to shared Get-Disk-Partitions-v2 helper.
                       - Added .SYNOPSIS header and aligned metadata versioning/documentation with current script behavior.
    v1.1: [Apr 2026] - Enhanced CIM logic for disk enumeration and partition discovery
    v1.0: Initial commit - Sets BCD boot status policy to IgnoreAllFailures to break Automatic Repair loops
@EdwinBernal1

Copy link
Copy Markdown
Member

Issues Found

🟡 Side effect risk: temporary EFI letter assignment not cleaned up

The script mounts hidden EFI partitions with Set-Partition -NewDriveLetter but does not unassign them in cleanup. This can leave unexpected mounted system partitions on rescue hosts.

Recommendation: track newly assigned letters and remove them in finally.

🟢 Minor: hidden partition filter may miss null-letter cases

Filter uses DriveLetter -eq 0 for hidden partitions. Depending on object shape, unlettered partitions can appear as null rather than 0.

Recommendation: include null/empty checks (e.g., -not $_.DriveLetter).

anmocanu added 2 commits July 13, 2026 16:57
Updated script to enhance BCD modification process and logging.
Updated script to improve BCD handling and logging.
@EdwinBernal1

Copy link
Copy Markdown
Member

@anmocanu could you help us with the review of these findings

Findings

Critical

File Context Issue Recommendation
None

Warning

File Context Issue Recommendation
win-ignoreAllFailures.ps1 control-flow placement In the fetched diff, the nested-VM guard and the main partition-scan loop appear associated with the finally region. This is very likely a diff-extraction artifact, but if the scan actually ran in finally the main remediation could execute after the catch. Verify in the raw file that the Stop-VM guard, Get-Disk-Partitions call, and the forEach ($diskGroup ...) remediation loop live in the main try, not finally.
win-ignoreAllFailures.ps1 logging Log location moved from the CustomScriptExtension plugin dir to the Desktop only — reduces automatic collection by az vm repair run. Restore dual-write (Desktop + plugin dir) as in #127.
win-ignoreAllFailures.ps1 EFI letter Set-Partition -NewDriveLetter assignment; cleanup is in finally (good), but a hard kill could orphan a mount. Acceptable; finally cleanup is the correct mitigation.

Info

File Context Suggestion
win-ignoreAllFailures.ps1 exit-code checks Per-step bcdedit exit-code validation with continue-on-failure is the most thorough command-result handling in the batch. Good.
win-ignoreAllFailures.ps1 helper reuse Dropping the bespoke inline CIM enumeration in favor of Get-Disk-Partitions-v2 reduces duplicated code and is consistent with the rest of the batch.
win-ignoreAllFailures.ps1 version Title and in-file .VERSION agree (v1.2) — no discrepancy here.

Operational Risk Assessment

Factor Rating Notes
Scope Low Single script; BCD edit + temporary EFI mount.
Destructive ops Low bcdedit /set bootstatuspolicy is reversible; temp letter add/remove only; no file/registry deletion.
Rollback possible Yes Policy can be reverted with bcdedit; .VERIFICATION documents checks.
Testing documented Yes (guide) .SCENARIO_RECREATION/.VERIFICATION provided.
Gen compatibility Gen1+Gen2 Explicit hidden-EFI mounting handles Gen2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants