Skip to content

Update win-update-registry.ps1 to v1.1#129

Open
anmocanu wants to merge 1 commit into
Azure:mainfrom
anmocanu:patch-12
Open

Update win-update-registry.ps1 to v1.1#129
anmocanu wants to merge 1 commit into
Azure:mainfrom
anmocanu:patch-12

Conversation

@anmocanu

Copy link
Copy Markdown
Contributor

.VERSION
v1.1: [May 2026] - Updated the script (current)
- Fixed Get-VM failure when Hyper-V module is not available on host.
- Added guarded nested VM validation with safe fallback logging.
- Added explicit runtime parameter validation for rootKey, propertyType, controlSet, and required inputs.
- Updated helper import to Get-Disk-Partitions-v2 and aligned partition processing flow.
- Added rescue OS drive exclusion to avoid modifying the running rescue VM hive.
- Added per-partition reg load failure handling (skip bad partition, continue others).
- Added structured step-by-step logging, timestamped CSE log output, and final status tracking.
- Improved error handling to continue processing partitions safely and report aggregate result.
v1.0: Initial version

.VERSION
    v1.1: [May 2026] - Updated the script (current)
                       - Fixed Get-VM failure when Hyper-V module is not available on host.
                       - Added guarded nested VM validation with safe fallback logging.
                       - Added explicit runtime parameter validation for rootKey, propertyType, controlSet, and required inputs.
                       - Updated helper import to Get-Disk-Partitions-v2 and aligned partition processing flow.
                       - Added rescue OS drive exclusion to avoid modifying the running rescue VM hive.
                       - Added per-partition reg load failure handling (skip bad partition, continue others).
                       - Added structured step-by-step logging, timestamped CSE log output, and final status tracking.
                       - Improved error handling to continue processing partitions safely and report aggregate result.
    v1.0: Initial version
@EdwinBernal1 EdwinBernal1 self-requested a review June 16, 2026 13:59
@EdwinBernal1

EdwinBernal1 commented Jun 16, 2026

Copy link
Copy Markdown
Member

Issues Found

🟡 Validation mismatch: allows unsupported root hives for reg load

Script validates rootKey as one of HKLM, HKCC, HKCR, HKCU, HKU, but reg load supports hive mount targets under HKLM/HKU in practical use. Allowing HKCC/HKCR/HKCU can pass validation and still fail at runtime.

Recommendation: restrict accepted rootKey to HKLM and HKU for this script path.

🟡 Load failure detection relies on output text, not exit code

Failure handling checks $loadResult -match 'ERROR' rather than $LASTEXITCODE. This is fragile for localization/nonstandard output.

Recommendation: treat nonzero $LASTEXITCODE as authoritative and use text only for diagnostics.

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