Create RunOnce key if inexistent

This commit is contained in:
Manuel Thalmann 2023-06-25 18:05:55 +02:00
parent 1843f455e8
commit 9990fce5ab

View file

@ -81,7 +81,13 @@ class Context {
}
Push-Location $userKey.PSPath;
$result = Get-Item "Software\Microsoft\Windows\CurrentVersion\RunOnce";
$runOncePath = "Software\Microsoft\Windows\CurrentVersion\RunOnce";
if (-not (Test-Path $runOncePath)) {
New-Item $runOncePath;
}
$result = Get-Item $runOncePath;
Pop-Location;
return $result;
}