added architecture and other minor changes for winget app downloads

This commit is contained in:
rbalsleyMSFT
2024-07-01 16:22:56 -07:00
parent bd4e3a1913
commit c30aa90e8b
+4 -3
View File
@@ -1748,7 +1748,7 @@ function Get-Win32App {
New-Item -Path $appFolderPath -ItemType Directory -Force | Out-Null
$appFolder = Split-Path -Path $appFolderPath -Leaf
WriteLog "Downloading $Win32App..."
$wingetDownloadResult = & winget.exe download --name "$Win32App" --exact --download-directory "$appFolderPath" --scope machine --source winget | Out-String
$wingetDownloadResult = & winget.exe download --name "$Win32App" --exact --download-directory "$appFolderPath" --scope machine --source winget --architecture "$WindowsArch" | Out-String
if ($wingetDownloadResult -notmatch "Installer downloaded") {
WriteLog "$Win32App did not successfully download."
Remove-Item -Path $appFolderPath -Recurse -Force
@@ -1793,7 +1793,8 @@ function Get-StoreApp {
# Invoke-Process is not used here because it terminates the script if the exit code of the process is not zero.
# WinGet's download command will return a non-zero exit code when downloading store apps, as attempting to download the license file always appears to cause an error.
WriteLog "Downloading $StoreApp and dependencies..."
$wingetDownloadResult = & winget.exe download --name --exact "$StoreApp" --download-directory "$appFolderPath" --accept-package-agreements --accept-source-agreements --source msstore | Out-String
WriteLog 'MSStore app downloads require authentication with an Entra ID account. You may be prompted twice for credentials, once for the app and another for the license file.'
$wingetDownloadResult = & winget.exe download --name --exact "$StoreApp" --download-directory "$appFolderPath" --accept-package-agreements --accept-source-agreements --source msstore --architecture "$WindowsArch" --scope machine | Out-String
# Many store apps can be found by winget search, but the download of the apps are unsupported.
if ($wingetDownloadResult -match "No applicable Microsoft Store package download information found.") {
WriteLog "No applicable Microsoft Store package download information found for $StoreApp. Skipping download."
@@ -1807,7 +1808,7 @@ function Get-StoreApp {
Set-Content -Path "$AppsPath\InstallAppsandSysprep.cmd" -Value $updatedcmdContent
}
WriteLog "$StoreApp has completed downloading. Identifying the latest version of $StoreApp."
$packages = Get-ChildItem -Path "$appFolderPath\*" -Exclude "Dependencies\*" -File
$packages = Get-ChildItem -Path "$appFolderPath\*" -Exclude "Dependencies\*", "*.xml", "*.yaml" -File
# WinGet downloads multiple versions of certain store apps. The latest version of the package will be determined based on the date of the file signature.
$latestPackage = ""
$latestDate = [datetime]::MinValue