mirror of
https://github.com/MicrosoftDocs/windows-itpro-docs.git
synced 2025-06-18 11:53:37 +00:00
Added Get-AppAUMID function
This commit is contained in:
@ -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
|
||||||
|
```
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user