Allow parameterless handling of reboot registration
This commit is contained in:
parent
00a8337013
commit
94c74c8468
1 changed files with 9 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue