mirror of
https://github.com/rbalsleyMSFT/FFU.git
synced 2026-06-14 02:09:35 -06:00
Update example usage in Invoke-AppsScript.ps1 and modify Orchestrator.ps1 to include AppsScript execution logic
- Changed example variable checks in Invoke-AppsScript.ps1 to reflect accurate usage of the AppsScriptVariables hashtable. - Removed Invoke-AppsScript.ps1 from the script list in Orchestrator.ps1 and added logic to invoke it conditionally based on the presence of AppsScriptVariables.json. - Enhanced output messages for clarity during script execution. - Updated AppsScriptVariables parameter description in BuildFFUVM.ps1 to clarify its purpose and usage.
This commit is contained in:
@@ -38,8 +38,8 @@ else {
|
|||||||
|
|
||||||
# Example of how to use the AppsScriptVariables hashtable to control script execution
|
# Example of how to use the AppsScriptVariables hashtable to control script execution
|
||||||
|
|
||||||
# Example: Check if a variable named 'foo' is set to string 'true' and run a script accordingly
|
# Example: Check if a variable named 'foo' is set to string 'bar' and run a script accordingly
|
||||||
# if ($AppsScriptVariables['foo'] -eq 'true') {
|
# if ($AppsScriptVariables['foo'] -eq 'bar') {
|
||||||
# Write-Host "Foo would have installed"
|
# Write-Host "Foo would have installed"
|
||||||
# }
|
# }
|
||||||
# else {
|
# else {
|
||||||
@@ -47,11 +47,11 @@ else {
|
|||||||
# }
|
# }
|
||||||
|
|
||||||
# Example: Check if a variable named 'foo' is set to boolean $true and run a script accordingly
|
# Example: Check if a variable named 'foo' is set to boolean $true and run a script accordingly
|
||||||
# if ($AppsScriptVariables['foo'] -eq $true) {
|
# if ($AppsScriptVariables[Teams] -eq $true) {
|
||||||
# Write-Host "Foo would have been installed"
|
# Write-Host "Teams would have been installed"
|
||||||
# }
|
# }
|
||||||
# else {
|
# else {
|
||||||
# Write-Host "Foo would not have installed"
|
# Write-Host "Teams would not have been installed"
|
||||||
# }
|
# }
|
||||||
|
|
||||||
# Your code below here
|
# Your code below here
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ $scriptList = @(
|
|||||||
"Update-Edge.ps1",
|
"Update-Edge.ps1",
|
||||||
"Install-Win32Apps.ps1",
|
"Install-Win32Apps.ps1",
|
||||||
"Install-StoreApps.ps1",
|
"Install-StoreApps.ps1",
|
||||||
"Invoke-AppsScript.ps1",
|
|
||||||
"Install-UserApps.ps1"
|
"Install-UserApps.ps1"
|
||||||
)
|
)
|
||||||
# Check if each script exists and run it if it does
|
# Check if each script exists and run it if it does
|
||||||
@@ -46,7 +45,7 @@ foreach ($script in $scriptList) {
|
|||||||
if (Test-Path -Path $scriptFile) {
|
if (Test-Path -Path $scriptFile) {
|
||||||
Write-Host "`n" # Add a newline for spacing
|
Write-Host "`n" # Add a newline for spacing
|
||||||
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
||||||
Write-Host " Running script: $script" -ForegroundColor Yellow
|
Write-Host " Running script: $script " -ForegroundColor Yellow
|
||||||
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
||||||
# Run script and wait for it to finish
|
# Run script and wait for it to finish
|
||||||
# pause
|
# pause
|
||||||
@@ -54,12 +53,25 @@ foreach ($script in $scriptList) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 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
|
# Run-DiskCleanup.ps1 must run before Run-Sysprep.ps1
|
||||||
$diskCleanupScript = Join-Path -Path $scriptPath -ChildPath "Run-DiskCleanup.ps1"
|
$diskCleanupScript = Join-Path -Path $scriptPath -ChildPath "Run-DiskCleanup.ps1"
|
||||||
if (Test-Path -Path $diskCleanupScript) {
|
if (Test-Path -Path $diskCleanupScript) {
|
||||||
Write-Host "`n" # Add a newline for spacing
|
Write-Host "`n" # Add a newline for spacing
|
||||||
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
||||||
Write-Host " Running script: Run-DiskCleanup.ps1" -ForegroundColor Yellow
|
Write-Host " Running script: Run-DiskCleanup.ps1 " -ForegroundColor Yellow
|
||||||
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
||||||
# Run script and wait for it to finish
|
# Run script and wait for it to finish
|
||||||
& $diskCleanupScript
|
& $diskCleanupScript
|
||||||
@@ -73,7 +85,7 @@ $sysprepScript = Join-Path -Path $scriptPath -ChildPath "Run-Sysprep.ps1"
|
|||||||
if (Test-Path -Path $sysprepScript) {
|
if (Test-Path -Path $sysprepScript) {
|
||||||
Write-Host "`n" # Add a newline for spacing
|
Write-Host "`n" # Add a newline for spacing
|
||||||
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
||||||
Write-Host " Running script: Run-Sysprep.ps1" -ForegroundColor Yellow
|
Write-Host " Running script: Run-Sysprep.ps1 " -ForegroundColor Yellow
|
||||||
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
Write-Host "---------------------------------------------------" -ForegroundColor Yellow
|
||||||
# Run script and wait for it to finish
|
# Run script and wait for it to finish
|
||||||
& $sysprepScript
|
& $sysprepScript
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ When set to $true, will cache the VHDX file to the $FFUDevelopmentPath\VHDXCache
|
|||||||
Path to a JSON file containing a list of applications to install using WinGet. Default is $FFUDevelopmentPath\Apps\AppList.json.
|
Path to a JSON file containing a list of applications to install using WinGet. Default is $FFUDevelopmentPath\Apps\AppList.json.
|
||||||
|
|
||||||
.PARAMETER AppsScriptVariables
|
.PARAMETER AppsScriptVariables
|
||||||
When passed a hashtable, the script will alter the $FFUDevelopmentPath\Apps\InstallAppsandSysprep.cmd file to set variables with the hashtable keys as variable names and the hashtable values their content.
|
When passed a hashtable, the script will create an AppsScriptVariables.json file in the OrchestrationPath. This file will be used to pass variables to the Apps script. The hashtable should contain key-value pairs where the key is the variable name and the value is the variable value.
|
||||||
|
|
||||||
.PARAMETER BuildUSBDrive
|
.PARAMETER BuildUSBDrive
|
||||||
When set to $true, will partition and format a USB drive and copy the captured FFU to the drive.
|
When set to $true, will partition and format a USB drive and copy the captured FFU to the drive.
|
||||||
|
|||||||
Reference in New Issue
Block a user