mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
eac8be3d31
Updates the FFU UI and orchestration scripts to allow users to specify custom file paths for their Bring Your Own (BYO) app lists, rather than forcing the use of `UserAppList.json` in a specific directory. Also modifies the orchestration to sync this custom path via `AppInstallConfig.json` so that the runtime orchestration phase resolves the correct file name and path during installation. Refreshes the Apps ISO if the custom BYO app list is updated.
139 lines
5.4 KiB
PowerShell
139 lines
5.4 KiB
PowerShell
<#
|
|
.SYNOPSIS
|
|
Orchestration script for FFU VM deployment tasks
|
|
|
|
.DESCRIPTION
|
|
This script orchestrates the following deployment tasks:
|
|
- Install-Office.ps1
|
|
- Update-Defender.ps1
|
|
- Update-MSRT.ps1
|
|
- Update-OneDrive.ps1
|
|
- Update-Edge.ps1
|
|
- Install-Win32Apps.ps1
|
|
- Invoke-AppsScript.ps1
|
|
- Install-UserApps.ps1
|
|
- Install-StoreApps.ps1
|
|
- Run-DiskCleanup.ps1
|
|
- Run-Sysprep.ps1
|
|
|
|
The script will check for the presence of each of these files and if they exist, will run the script
|
|
#>
|
|
|
|
# Header
|
|
|
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
|
Write-Host " FFU Builder Orchestrator " -ForegroundColor Yellow
|
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
|
|
|
# Define the path to the scripts
|
|
$scriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition
|
|
|
|
# Resolve the configured BYO app list path for runtime orchestration.
|
|
$appInstallConfigPath = Join-Path -Path $scriptPath -ChildPath "AppInstallConfig.json"
|
|
$userAppsJsonFile = Join-Path -Path (Split-Path -Parent $scriptPath) -ChildPath "UserAppList.json"
|
|
|
|
if (Test-Path -Path $appInstallConfigPath) {
|
|
try {
|
|
$appInstallConfig = Get-Content -Path $appInstallConfigPath -Raw | ConvertFrom-Json
|
|
if ($null -ne $appInstallConfig -and $appInstallConfig.PSObject.Properties.Match('UserAppListPath').Count -gt 0 -and -not [string]::IsNullOrWhiteSpace($appInstallConfig.UserAppListPath)) {
|
|
$userAppsJsonFile = $appInstallConfig.UserAppListPath
|
|
Write-Host "Using BYO app list path from AppInstallConfig.json: $userAppsJsonFile"
|
|
}
|
|
}
|
|
catch {
|
|
Write-Host "Failed to parse AppInstallConfig.json. Falling back to default BYO app list path."
|
|
}
|
|
}
|
|
|
|
# Define the list of scripts to run
|
|
$scriptList = @(
|
|
"Install-LTSCUpdate.ps1",
|
|
"Update-Defender.ps1",
|
|
"Install-Office.ps1",
|
|
"Update-MSRT.ps1",
|
|
"Update-OneDrive.ps1",
|
|
"Update-Edge.ps1",
|
|
"Install-Win32Apps.ps1",
|
|
"Install-StoreApps.ps1",
|
|
"Install-UserApps.ps1"
|
|
)
|
|
# Check if each script exists and has content to process, then run it
|
|
foreach ($script in $scriptList) {
|
|
$scriptFile = Join-Path -Path $scriptPath -ChildPath $script
|
|
if (-not (Test-Path -Path $scriptFile)) {
|
|
continue
|
|
}
|
|
|
|
$shouldRun = $true # Default to run if script exists
|
|
switch ($script) {
|
|
"Install-Win32Apps.ps1" {
|
|
$wingetAppsJsonFile = Join-Path -Path $scriptPath -ChildPath "WinGetWin32Apps.json"
|
|
if (-not (Test-Path -Path $wingetAppsJsonFile) -and -not (Test-Path -Path $userAppsJsonFile)) {
|
|
$shouldRun = $false
|
|
}
|
|
}
|
|
"Install-StoreApps.ps1" {
|
|
$msStorePath = "D:\MSStore"
|
|
if (-not (Test-Path -Path $msStorePath) -or -not (Get-ChildItem -Path $msStorePath)) {
|
|
$shouldRun = $false
|
|
}
|
|
}
|
|
}
|
|
|
|
if ($shouldRun) {
|
|
Write-Host "`n" # Add a newline for spacing
|
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
|
Write-Host " Running script: $script " -ForegroundColor Yellow
|
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
|
# Run script and wait for it to finish.
|
|
if ($script -eq "Install-Win32Apps.ps1") {
|
|
& $scriptFile -UserAppsJsonFile $userAppsJsonFile
|
|
}
|
|
else {
|
|
& $scriptFile
|
|
}
|
|
}
|
|
}
|
|
|
|
# Invoke-AppsScript.ps1 if it exists and AppsScriptVariables.json is present
|
|
$appsScriptFile = Join-Path -Path $scriptPath -ChildPath "Invoke-AppsScript.ps1"
|
|
$appsScriptVarsJsonPath = Join-Path -Path $PSScriptRoot -ChildPath "AppsScriptVariables.json"
|
|
if ((Test-Path -Path $appsScriptFile) -and (Test-Path -Path $appsScriptVarsJsonPath)) {
|
|
Write-Host "`n" # Add a newline for spacing
|
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
|
Write-Host " Running script: Invoke-AppsScript.ps1 " -ForegroundColor Yellow
|
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
|
|
|
Write-Host "Using AppsScriptVariables from JSON file: $appsScriptVarsJsonPath"
|
|
& $appsScriptFile
|
|
}
|
|
|
|
# Run-DiskCleanup.ps1 must run before Run-Sysprep.ps1
|
|
$diskCleanupScript = Join-Path -Path $scriptPath -ChildPath "Run-DiskCleanup.ps1"
|
|
if (Test-Path -Path $diskCleanupScript) {
|
|
Write-Host "`n" # Add a newline for spacing
|
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
|
Write-Host " Running script: Run-DiskCleanup.ps1 " -ForegroundColor Yellow
|
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
|
# Run script and wait for it to finish
|
|
& $diskCleanupScript
|
|
|
|
} else {
|
|
Write-Host "Run-DiskCleanup.ps1 not found!"
|
|
}
|
|
|
|
# Run-Sysprep.ps1 must run last
|
|
$sysprepScript = Join-Path -Path $scriptPath -ChildPath "Run-Sysprep.ps1"
|
|
if (Test-Path -Path $sysprepScript) {
|
|
Write-Host "`n" # Add a newline for spacing
|
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
|
Write-Host " Running script: Run-Sysprep.ps1 " -ForegroundColor Yellow
|
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
|
# Run script and wait for it to finish
|
|
& $sysprepScript
|
|
} else {
|
|
Write-Host "Run-Sysprep.ps1 not found!"
|
|
}
|
|
|
|
|