Search code examples
powershelluwpwin-universal-app

Get the "plain" (end-user readable) name of UWP apps installed on a system


I'm using the following PowerShell script to retrieve and save to a text file the list of UWP apps on a system. It gets the ID, name (system name) and packagefamilyname.

In addition to the name, I'm looking for a way to retrieve the plain name of the app: for example, "OneNote" instead of "Microsoft.Office.OneNote". Ideally, this name would also be localized: for example, "Calculatrice" (on a French system) instead of "Microsoft.WindowsCalculator".

I found this list of info retrieved by Get-AppxPackage but nothing like an end-user readable name... I'm not very familiar this area of expertise. Any help would be appreciated.

$installedapps = get-AppxPackage
$ids = $null

foreach ($app in $installedapps)
{
  try
  {
    $ids = (Get-AppxPackageManifest $app -erroraction Stop).package.applications.application.id
  }
  catch
  {
    Write-Output "No Id's found for $($app.name)" 
  }
  foreach ($id in $ids)
  {
    $line = $app.Name + "`t" + $app.packagefamilyname + "!" + $id
    echo $line
    $line >> 'c:\temp\output.txt'
  }
}
write-host "Press any key to continue..."
[void][System.Console]::ReadKey($true)

Solution

  • [Completed updated]

    You can do this pretty easily in C#. You have to reference the correct WinMDs from the Windows SDK (the actual directories will change depending on SDK version):

    • C:\Program Files (x86)\Windows Kits\10\References\10.0.17134.0\Windows.Foundation.FoundationContract\3.0.0.0\Windows.Foundation.FoundationContract.winmd
    • C:\Program Files (x86)\Windows Kits\10\References\10.0.17134.0\Windows.Foundation.UniversalApiContract\6.0.0.0\Windows.Foundation.UniversalApiContract.winmd

    If you can't build a stand-alone EXE and just want pure PowerShell, you might be able to reference the WinMDs %systemroot%\system32\winmetadata. The code is pretty simple (I avoided await since I don't know if PowerShell has that):

    // using Windows.Management.Deployment;
    
    static void Main(string[] args)
    {
        GetList();
    }
    
    static void GetList()
    {
        var pm = new PackageManager();
        var packages = pm.FindPackagesForUser("");
        foreach (var package in packages)
        {
            var asyncResult = package.GetAppListEntriesAsync();
            while (asyncResult.Status != Windows.Foundation.AsyncStatus.Completed)
            {
                Thread.Sleep(10);
            }
    
            foreach (var app in asyncResult.GetResults())
            {
                Console.WriteLine(app.DisplayInfo.DisplayName);
            }
        }
    }