From 5545554d7e07a57e2cdd2e9e57a782c2ba558bc4 Mon Sep 17 00:00:00 2001 From: JonasKloseBW Date: Thu, 26 Sep 2024 20:08:47 +0200 Subject: [PATCH] Update BuildFFUVM.ps1 - Fix accidental variable accumulation in InstallAppsandSysprep.cmd --- FFUDevelopment/BuildFFUVM.ps1 | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/FFUDevelopment/BuildFFUVM.ps1 b/FFUDevelopment/BuildFFUVM.ps1 index d97fd16..5e2f5b6 100644 --- a/FFUDevelopment/BuildFFUVM.ps1 +++ b/FFUDevelopment/BuildFFUVM.ps1 @@ -4030,18 +4030,16 @@ if ($InstallApps) { WriteLog "Update complete" } - if (-not $AppsScriptVariables) { - #Modify InstallAppsandSysprep.cmd to remove the script variables - $CmdContent = Get-Content -Path "$AppsPath\InstallAppsandSysprep.cmd" - $StartIndex = $CmdContent.IndexOf("REM START Batch variables placeholder") - $EndIndex = $CmdContent.IndexOf("REM END Batch variables placeholder") - if (($StartIndex + 1) -lt $EndIndex) { - for ($i = ($StartIndex + 1); $i -lt $EndIndex; $i++) { - $CmdContent[$i] = $null - } + #Modify InstallAppsandSysprep.cmd to remove old script variables + $CmdContent = Get-Content -Path "$AppsPath\InstallAppsandSysprep.cmd" + $StartIndex = $CmdContent.IndexOf("REM START Batch variables placeholder") + $EndIndex = $CmdContent.IndexOf("REM END Batch variables placeholder") + if (($StartIndex + 1) -lt $EndIndex) { + for ($i = ($StartIndex + 1); $i -lt $EndIndex; $i++) { + $CmdContent[$i] = $null } - Set-Content -Path "$AppsPath\InstallAppsandSysprep.cmd" -Value $CmdContent } + Set-Content -Path "$AppsPath\InstallAppsandSysprep.cmd" -Value $CmdContent if ($AppsScriptVariables) { #Modify InstallAppsandSysprep.cmd to add the script variables