From 5623edae66a2c6057664c5eedd0f60cb84215ed3 Mon Sep 17 00:00:00 2001 From: djust270 Date: Wed, 12 Oct 2022 14:58:52 -0400 Subject: [PATCH] Added Get-AppAUMID function --- ...ation-user-model-id-of-an-installed-app.md | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/windows/configuration/find-the-application-user-model-id-of-an-installed-app.md b/windows/configuration/find-the-application-user-model-id-of-an-installed-app.md index 27d56ce3c5..8b57c08b2f 100644 --- a/windows/configuration/find-the-application-user-model-id-of-an-installed-app.md +++ b/windows/configuration/find-the-application-user-model-id-of-an-installed-app.md @@ -109,3 +109,40 @@ listAumids("CustomerAccount") # Get a list of AUMIDs for all accounts on the device: listAumids("allusers") ``` + +## Example +The following code sample creates a function in Windows PowerShell that returns the AUMID of any application currently listed in the Start Menu + +```powershell +function Get-AppAUMID { +param ( +[string]$AppName +) +$Apps = (New-Object -Com Shell.Application).NameSpace('shell:::{4234d49b-0245-4df3-b780-3893943456e1}').Items() +if ($AppName){ + $Result = $Apps | Where-Object { $_.name -like "*$AppName*" } | Select-Object name,@{n="AUMID";e={$_.path}} + if ($Result){ + Return $Result + } + else {"Unable to locate {0}" -f $AppName} +} +else { + $Result = $Apps | Select-Object name,@{n="AUMID";e={$_.path}} + Return $Result +} +} +``` + +The following Windows PowerShell commands demonstrate how you can call the Get-AppAUMID function after you've created it. + +```powershell +# Get the AUMID for OneDrive +Get-AppAUMID -AppName OneDrive + +# Get the AUMID for Microsoft Word +Get-AppAUMID -AppName Word + +# List all apps and their AUMID in the Start Menu +Get-AppAUMID +``` +