@@ -92,18 +92,72 @@ Get-ItemProperty "HKLM:\SOFTWARE\Policies\Microsoft\Windows\CloudContent" -Name
9292Get-ItemProperty "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Privacy" -Name "TailoredExperiencesWithDiagnosticDataEnabled" -ErrorAction SilentlyContinue
9393```
9494
95- ### 📋 ** Testing Environment**
96- - ** OS** : Windows 10/11
97- - ** PowerShell Version** : 5.1 (Windows PowerShell Desktop)
98- - ** Test User** : TestVM
99- - ** Execution** : Administrator privileges required
100- - ** Result** : Script completed successfully with registry settings properly applied
101-
10295### 🔗 ** Related Issues**
10396- ** Issue #1 ** : HKU drive not found error
10497- ** Issue #2 ** : PropertyType parameter not recognized
10598- ** Issue #3 ** : Registry settings not applying to user profiles
99+ Registry Hive Dismount Improvements
100+
101+ 🎯 Key Enhancements:
102+ 1 . Retry Logic with Intelligent Backoff
103+ 3 attempts per registry hive with increasing delays
104+ Progressive wait times: 2s → 5s → final attempt
105+ Success tracking to avoid unnecessary retries
106+
107+ 2 . Enhanced Handle Management
108+ Explicit registry key cleanup using .NET Registry classes
109+ Triple garbage collection (collect → finalize → collect)
110+ Extended wait periods for handles to be released
111+ Process diagnostics to identify handle conflicts
112+
113+ 3 . Better Error Classification
114+ Success/Warning/Error levels with appropriate messaging
115+ Diagnostic information for troubleshooting
116+ Non-critical failure handling (dismount failures often don't affect functionality)
117+
118+ 4 . Improved Default User Handling
119+ Finally block ensures unmount attempts even on errors
120+ Separate retry logic for default user profile
121+ Mount state tracking to avoid unmounting non-mounted hives
122+
123+ 5 . Enhanced Error Recovery
124+ Emergency cleanup in catch blocks
125+ Null checking for user profiles array
126+ Graceful degradation when cleanup fails
127+
128+ 🔍 New Log Messages:
129+ Success Cases:
130+ [ INFO] Successfully dismounted registry hive for: Username
131+ [ INFO] Successfully unmounted default user registry hive
132+
133+ Retry Cases:
134+ [ WARN] Dismount attempt 1 failed for Username (Exit code: 1)
135+ [ INFO] Waiting before retry...
136+ [ INFO] Dismount attempt 2 of 3 for: Username
137+
138+ Diagnostic Info:
139+ [ INFO] Found 2 reg.exe processes that may be holding handles
140+ [ WARN] Failed to dismount registry hive for Username after 3 attempts. This may not affect system functionality.
141+
142+ ⚙️ Technical Details:
143+ Handle Cleanup Process:
144+ Garbage Collection - Release managed references
145+ Registry Key Closure - Explicitly close .NET registry handles
146+ Process Diagnostics - Check for conflicting reg.exe processes
147+ Delayed Retry - Allow system time to release resources
148+
149+ Retry Strategy:
150+ Attempt 1: Immediate after cleanup (2s delay)
151+ Attempt 2: 5s delay for handle release
152+ Attempt 3: Final attempt with extended cleanup
106153
107- ** Next Version** : 2.1.2 (Planned improvements to registry hive dismount handling)
108154** Compatibility** : Windows 10 (1809+), Windows 11
109155** Prerequisites** : PowerShell 5.1+, Administrator privileges, Winget installed
156+
157+ ### 📋 ** Testing Environment**
158+ - ** OS** : Windows 10/11
159+ - ** PowerShell Version** : 5.1 (Windows PowerShell Desktop)
160+ - ** Test User** : TestVM
161+ - ** Execution** : Administrator privileges required
162+ - ** Result** : Script completed successfully with registry settings properly applied
163+
0 commit comments