Added Get-AppAUMID function

This commit is contained in:
djust270
2022-10-12 14:58:52 -04:00
parent 9dc7d180c6
commit 5623edae66

View File

@ -109,3 +109,40 @@ listAumids("CustomerAccount")
# Get a list of AUMIDs for all accounts on the device: # Get a list of AUMIDs for all accounts on the device:
listAumids("allusers") 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
```