Files
FFU/FFUDevelopment/Apps/Orchestration/Install-StoreApps.ps1
T
rbalsleyMSFT 576c0a82f8 Improve script output readability
Adds a blank line after each application installation command. This visually separates the output for each app, making the logs easier to read in the terminal.
2025-07-23 20:56:36 -07:00

57 lines
2.1 KiB
PowerShell

$basePath = "D:\MSStore"
# Check if the base path exists
Write-Host "Installing Store Apps: Checking for $basePath"
if (-not (Test-Path -Path $basePath)) {
Write-Host "Installing Store Apps: $basePath does not exist."
exit
}
Write-Host "Installing Store Apps: $basePath exists, installing apps."
# Process each app folder in the base path
foreach ($appFolder in Get-ChildItem -Path $basePath -Directory) {
$folderPath = $appFolder.FullName
$dependenciesFolder = Join-Path -Path $folderPath -ChildPath "Dependencies"
# Find main package - exclude Dependencies folder items and xml/yaml files
$mainPackage = Get-ChildItem -Path $folderPath -File |
Where-Object {
$_.DirectoryName -ne $dependenciesFolder -and
$_.Extension -ne ".xml" -and
$_.Extension -ne ".yaml"
} | Select-Object -First 1
if ($mainPackage) {
# Build DISM command with main package
$dismParams = @(
"/Online"
"/Add-ProvisionedAppxPackage"
"/PackagePath:`"$($mainPackage.FullName)`""
"/Region:all"
"/StubPackageOption:installfull"
)
# Add dependency packages if they exist
if (Test-Path -Path $dependenciesFolder) {
$dependencies = Get-ChildItem -Path $dependenciesFolder -File
foreach ($dependency in $dependencies) {
$dismParams += "/DependencyPackagePath:`"$($dependency.FullName)`""
}
}
# Look for license file and add appropriate parameter
$licenseFile = Get-ChildItem -Path $folderPath -Filter "*.xml" -File | Select-Object -First 1
if ($licenseFile) {
$dismParams += "/LicensePath:`"$($licenseFile.FullName)`""
} else {
$dismParams += "/SkipLicense"
}
# Construct final command
$dismCommand = "DISM " + ($dismParams -join " ")
# Output and execute the command
Write-Output $dismCommand
Invoke-Expression -Command $dismCommand
Write-Output ""
}
}