Add AppsList, modified InstallAppsandSysprep.cmd file with store apps installation, and updated Clear-InstallAppsandSysprep function

This commit is contained in:
Zehadi Alam
2024-06-30 19:42:06 -04:00
parent cafff0b484
commit 1729eaddd6
3 changed files with 38 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
win32:7-Zip
store:Company Portal
@@ -1,3 +1,4 @@
setlocal enabledelayedexpansion
REM Put each app install on a separate line REM Put each app install on a separate line
REM M365 Apps/Office ProPlus REM M365 Apps/Office ProPlus
REM d:\Office\setup.exe /configure d:\office\DeployFFU.xml 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 Add additional apps below here
REM Contoso App (Example) REM Contoso App (Example)
REM msiexec /i d:\Contoso\setup.msi /qn /norestart 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 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 REM Also kills the sysprep process in order to automate sysprep generalize
del c:\windows\panther\unattend\unattend.xml /F /Q del c:\windows\panther\unattend\unattend.xml /F /Q
+6
View File
@@ -3050,6 +3050,12 @@ function Remove-FFU {
WriteLog "Removal complete" WriteLog "Removal complete"
} }
function Clear-InstallAppsandSysprep { 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) { if ($UpdateLatestDefender) {
WriteLog "Updating $AppsPath\InstallAppsandSysprep.cmd to remove Defender Platform Update" WriteLog "Updating $AppsPath\InstallAppsandSysprep.cmd to remove Defender Platform Update"
$CmdContent = Get-Content -Path "$AppsPath\InstallAppsandSysprep.cmd" $CmdContent = Get-Content -Path "$AppsPath\InstallAppsandSysprep.cmd"