From 839e0ccaafeccca7067ea94e1e71f9bba44e3778 Mon Sep 17 00:00:00 2001 From: Manuel Thalmann Date: Fri, 9 Aug 2024 04:08:22 +0200 Subject: [PATCH] Skip `PWSH_PATH` if undefined --- scripts/Windows/Scripts/PowerManagement.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/scripts/Windows/Scripts/PowerManagement.ps1 b/scripts/Windows/Scripts/PowerManagement.ps1 index 2741bcf9..774eaa98 100644 --- a/scripts/Windows/Scripts/PowerManagement.ps1 +++ b/scripts/Windows/Scripts/PowerManagement.ps1 @@ -30,7 +30,13 @@ $null = New-Module { Set-ItemProperty -Path $key.PSPath -Name $runOnceName -Type "ExpandString" -Value ( "pwsh -Command " + - "`$env:PWSH_PATH = $(ConvertTo-Injection $env:PWSH_PATH);" + + (& { + if ($env:PWSH_PATH) { + "`$env:PWSH_PATH = $(ConvertTo-Injection $env:PWSH_PATH);" + } else { + "" + } + }) + "`$env:INSTALLER_SCRIPT = $(ConvertTo-Injection $env:INSTALLER_SCRIPT);" + "`$env:CONFIG_MODULE = $(ConvertTo-Injection $env:CONFIG_MODULE);" + "& `$env:INSTALLER_SCRIPT;"