From 5a83a49bbd58d2b53216a221155bf8c219c988b4 Mon Sep 17 00:00:00 2001 From: David Ross Smith <5095074+DragRedSim@users.noreply.github.com> Date: Mon, 14 Feb 2022 21:49:12 +1100 Subject: [PATCH] Update GetAUMIDs.ps1 Corrected indentation, slight reorder of operations to avoid calculating unused variables --- GlosSIConfig/GetAUMIDs.ps1 | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/GlosSIConfig/GetAUMIDs.ps1 b/GlosSIConfig/GetAUMIDs.ps1 index b7dc5fb..4c516c4 100644 --- a/GlosSIConfig/GetAUMIDs.ps1 +++ b/GlosSIConfig/GetAUMIDs.ps1 @@ -9,26 +9,33 @@ foreach ($app in $installedapps) { foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id) { $appx = Get-AppxPackageManifest $app; $name = $appx.Package.Properties.DisplayName; - #filter out language packs and Sysinternals (adds ~30 entries, all non-game) - if ($app.packagefamilyname -like "Microsoft.Language*" -or $name -like "Sysinternals*") { break; } + + #filter out language packs and Sysinternals (adds ~30 entries, all non-game) + if ($app.packagefamilyname -like "Microsoft.Language*" -or $name -like "Sysinternals*") { break; } + if ($name -like '*DisplayName*' -or $name -like '*ms-resource*') { $name = $appx.Package.Applications.Application.VisualElements.DisplayName; - } + } if ($name -like '*DisplayName*' -or $name -like '*ms-resource*') { $name = $app.Name; } - if ($name -like "MicrosoftWindows.*" -or $name -like "Microsoft.*" -or $name -like "Windows.*" -or $name -like "Windows Web*") { break; } + + #filter more apps with improper naming patterns; games generally have the appropriate field in their manifests filled out. + if ($name -like "MicrosoftWindows.*" -or $name -like "Microsoft.*" -or $name -like "Windows.*" -or $name -like "Windows Web*") { break; } $installDir = $app.InstallLocation; - #filter out system apps and apps installed by Microsoft without a proper UI name (none of which are games) + #filter out system apps and apps installed by Microsoft as part of Windows if ($installDir -like "*SystemApps*" -or $installDir -like "*Microsoft.Windows*") { break; } - $logo = $app.InstallLocation + "\" + ($appx.Package.Applications.Application.VisualElements.Square150x150Logo | Select-Object -First 1); - $assetpath = Split-Path -Path $logo -Parent - $sp = (Split-Path -Path $logo -Leaf).Split(".")[0] - $ext = ($appx.Package.Applications.Application.VisualElements.Square150x150Logo | Select-Object -First 1).Split(".")[-1] - if (-Not ($logo | Test-Path -PathType Leaf)) { #if this app uses qualifiers to provide different scaling factors and does not have an unqualified name, select the largest of those icons - $logo = Get-ChildItem -Path $($assetpath + '\' + $sp + '*.' + $ext) | Sort-Object -Property Length -Descending | Select-Object -First 1 -ExpandProperty FullName - } + + $logo = $app.InstallLocation + "\" + ($appx.Package.Applications.Application.VisualElements.Square150x150Logo | Select-Object -First 1); + + #if this app uses qualifiers to provide different scaling factors and does not have an unqualified name, select the largest of those icons + if (-Not ($logo | Test-Path -PathType Leaf)) { + $assetpath = Split-Path -Path $logo -Parent + $sp = (Split-Path -Path $logo -Leaf).Split(".")[0] + $ext = ($appx.Package.Applications.Application.VisualElements.Square150x150Logo | Select-Object -First 1).Split(".")[-1] + $logo = Get-ChildItem -Path $($assetpath + '\' + $sp + '*.' + $ext) | Sort-Object -Property Length -Descending | Select-Object -First 1 -ExpandProperty FullName + } $aumidList += $name + "|" + $installDir + "|" + $logo + "|" + $app.packagefamilyname + "!" + $id + ";"