diff --git a/FFUDevelopment/Apps/AppsList.txt b/FFUDevelopment/Apps/AppsList.txt new file mode 100644 index 0000000..6578766 --- /dev/null +++ b/FFUDevelopment/Apps/AppsList.txt @@ -0,0 +1,2 @@ +win32:7-Zip +store:Company Portal \ No newline at end of file diff --git a/FFUDevelopment/Apps/InstallAppsandSysprep.cmd b/FFUDevelopment/Apps/InstallAppsandSysprep.cmd index de29459..205d4c4 100644 --- a/FFUDevelopment/Apps/InstallAppsandSysprep.cmd +++ b/FFUDevelopment/Apps/InstallAppsandSysprep.cmd @@ -1,3 +1,4 @@ +setlocal enabledelayedexpansion REM Put each app install on a separate line REM M365 Apps/Office ProPlus REM d:\Office\setup.exe /configure d:\office\DeployFFU.xml @@ -9,6 +10,35 @@ REM Install Edge Stable REM Add additional apps below here REM Contoso App (Example) REM msiexec /i d:\Contoso\setup.msi /qn /norestart +set "INSTALL_STOREAPPS=false" +if /i "%INSTALL_STOREAPPS%"=="false" ( + echo Skipping MS Store installation due to INSTALL_STOREAPPS flag. + goto :remaining +) +set "basepath=D:\MSStore" +for /d %%D in ("%basepath%\*") do ( + set "appfolder=%%D" + set "mainpackage=" + set "dependenciesfolder=!appfolder!\Dependencies" + for %%F in ("!appfolder!\*") do ( + if not "%%~dpF"=="!dependenciesfolder!\" ( + set "mainpackage=%%F" + ) + ) + if defined mainpackage ( + if exist "!dependenciesfolder!" ( + set "dism_command=DISM /Online /Add-ProvisionedAppxPackage /PackagePath:"!mainpackage!"" + for %%G in ("!dependenciesfolder!\*") do ( + set "dism_command=!dism_command! /DependencyPackagePath:"%%G"" + ) + set "dism_command=!dism_command! /SkipLicense /Region:All" + echo !dism_command! + !dism_command! + ) + ) +) +:remaining +endlocal REM The below lines will remove the unattend.xml that gets the machine into audit mode. If not removed, the OS will get stuck booting to audit mode each time. REM Also kills the sysprep process in order to automate sysprep generalize del c:\windows\panther\unattend\unattend.xml /F /Q diff --git a/FFUDevelopment/BuildFFUVM.ps1 b/FFUDevelopment/BuildFFUVM.ps1 index 3480827..09fdd78 100644 --- a/FFUDevelopment/BuildFFUVM.ps1 +++ b/FFUDevelopment/BuildFFUVM.ps1 @@ -3050,6 +3050,12 @@ function Remove-FFU { WriteLog "Removal complete" } function Clear-InstallAppsandSysprep { + $cmdContent = Get-Content -Path "$AppsPath\InstallAppsandSysprep.cmd" + WriteLog "Updating $AppsPath\InstallAppsandSysprep.cmd to remove win32 app install commands" + $cmdContent -notmatch "D:\\win32*" | Set-Content -Path "$AppsPath\InstallAppsandSysprep.cmd" + $cmdContent = Get-Content -Path "$AppsPath\InstallAppsandSysprep.cmd" + WriteLog "Setting MSStore installation condition to false" + $cmdContent -replace 'set "INSTALL_STOREAPPS=true"', 'set "INSTALL_STOREAPPS=false"' | Set-Content -Path "$AppsPath\InstallAppsandSysprep.cmd" if ($UpdateLatestDefender) { WriteLog "Updating $AppsPath\InstallAppsandSysprep.cmd to remove Defender Platform Update" $CmdContent = Get-Content -Path "$AppsPath\InstallAppsandSysprep.cmd"