diff --git a/scripts/Windows/Scripts/Context.ps1 b/scripts/Windows/Scripts/Context.ps1 index ebedbf2d..1433dd15 100644 --- a/scripts/Windows/Scripts/Context.ps1 +++ b/scripts/Windows/Scripts/Context.ps1 @@ -71,6 +71,10 @@ class Context { $action.Invoke((Get-Item $root)); } + [Microsoft.Win32.RegistryKey] GetRunOnceKey() { + return $this.GetRunOnceKey($null); + } + [Microsoft.Win32.RegistryKey] GetRunOnceKey([Microsoft.Win32.RegistryKey] $userKey) { if (-not $userKey) { $userKey = Get-Item "HKCU:\"; @@ -79,7 +83,11 @@ class Context { return Get-Item $userKey "$userKey\Software\Microsoft\Windows\CurrentVersion\RunOnce"; } - [void] RegisterReboot([Microsoft.Win32.RegistryKey] $userKey = $null) { + [void] RegisterReboot() { + $this.RegisterReboot($null); + } + + [void] RegisterReboot([Microsoft.Win32.RegistryKey] $userKey) { $null = New-ItemProperty -Path $this.GetRunOnceKey($userKey) -Name $this.RunOnceName -Value "pwsh `"$($this.EntryPoint)`"" -PropertyType ExpandString; }