From b61c6d1d6063a2fd7e7490781107bc6f33062947 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Sun, 25 Jun 2023 18:05:55 +0200 Subject: [PATCH] Create `RunOnce` key if inexistent --- scripts/Windows/Scripts/Context.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/Windows/Scripts/Context.ps1 b/scripts/Windows/Scripts/Context.ps1 index 3ab4804e..e3670060 100644 --- a/scripts/Windows/Scripts/Context.ps1 +++ b/scripts/Windows/Scripts/Context.ps1 @@ -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; }