diff --git a/powershell/Remove-BuiltInApps.ps1 b/powershell/Remove-BuiltInApps.ps1 index 5c04e06..fc5739d 100644 --- a/powershell/Remove-BuiltInApps.ps1 +++ b/powershell/Remove-BuiltInApps.ps1 @@ -318,6 +318,8 @@ function Set-DefaultUserProfileDefaults { finally { if ($HiveWasLoaded) { Write-Host "Unloading default user registry hive..." -ForegroundColor Cyan + [GC]::Collect() + [GC]::WaitForPendingFinalizers() & reg.exe unload "HKU\DefaultUser" | Out-Null if ($LASTEXITCODE -ne 0) {