2
0
mirror of https://github.com/Alia5/GlosSI.git synced 2024-11-07 03:20:35 +00:00
GlosSI/GlosSIConfig/GetAUMIDs.ps1

52 lines
2.9 KiB
PowerShell
Raw Normal View History

#stolen and adapted from: https://github.com/BrianLima/UWPHook/blob/master/UWPHook/Resources/GetAUMIDScript.ps1
$installedapps = Get-AppxPackage
$invalidNames = '*ms-resource*', '*DisplayName*'
$aumidList = @()
2022-01-07 13:46:25 +00:00
foreach ($app in $installedapps) {
try {
2022-01-07 13:46:25 +00:00
if (-not $app.IsFramework) {
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; }
2022-01-07 13:46:25 +00:00
if ($name -like '*DisplayName*' -or $name -like '*ms-resource*') {
$name = $appx.Package.Applications.Application.VisualElements.DisplayName;
}
2022-01-07 13:46:25 +00:00
if ($name -like '*DisplayName*' -or $name -like '*ms-resource*') {
$name = $app.Name;
}
#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 "Windows.*" -or $name -like "Windows Web*") { break; }
2022-01-07 13:46:25 +00:00
$installDir = $app.InstallLocation;
#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);
#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
}
2022-01-07 13:46:25 +00:00
$aumidList += $name + "|" + $installDir + "|" + $logo + "|" +
$app.packagefamilyname + "!" + $id + ";"
}
}
2022-01-07 13:46:25 +00:00
}
catch {
$ErrorMessage = $_.Exception.Message
$FailedItem = $_.Exception.ItemName
}
}
$aumidList | Sort-Object #sorts the array by treating it as single strings per app, thus the first field (app name) is what it sorts on