diff --git a/scripts/Windows/Scripts/Context.ps1 b/scripts/Windows/Scripts/Context.ps1 index e3670060..a99a8f84 100644 --- a/scripts/Windows/Scripts/Context.ps1 +++ b/scripts/Windows/Scripts/Context.ps1 @@ -66,9 +66,11 @@ class Context { [void] ProcessDefaultUserKey([System.Action[Microsoft.Win32.RegistryKey]] $action) { $root = "HKLM:\DefaultUser"; + $regRoot = $root.Replace(":", ""); $hivePath = "$env:SystemDrive\Users\Default\NTUSER.dat" - $null = & reg load $root.Replace(":", "") $hivePath; + $null = & reg load $regRoot $hivePath; $action.Invoke((Get-Item $root)); + reg unload $regRoot; } [Microsoft.Win32.RegistryKey] GetRunOnceKey() {