查找已安装应用的应用程序用户模型 ID
若要) 配置 (展台模式分配的访问权限,需要在设备上安装的应用 (AUMID) 应用程序用户模型 ID。 可以使用 Windows PowerShell、文件资源管理器 或注册表查找 AUMID。
使用 Windows PowerShell
若要获取为当前用户安装的所有应用的名称和 AUMID,请打开Windows PowerShell命令提示符并输入以下命令:
Get-StartApps
若要获取为其他用户安装的 Windows 应用商店应用的名称和 AUMID,请打开Windows PowerShell命令提示符并输入以下命令:
$installedapps = Get-AppxPackage
$aumidList = @()
foreach ($app in $installedapps)
{
foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id)
{
$aumidList += $app.packagefamilyname + "!" + $id
}
}
$aumidList
可以将 或 -allusers
参数添加到 -user <username>
Get-AppxPackage cmdlet,以列出其他用户的 AUMID。 必须使用提升的Windows PowerShell提示符才能使用 -user
或 -allusers
参数。
使用 文件资源管理器
若要获取为当前用户安装的所有应用的名称和 AUMID,请执行以下步骤:
打开 “运行”,输入 shell:Appsfolder,然后选择“ 确定”。
此时会打开文件资源管理器窗口。 按 Alt>视图>选择详细信息。
在 “选择详细信息 ”窗口中,选择“ AppUserModelId”,然后选择“ 确定”。 (可能需要将 “视图” 设置从 “磁贴 ”更改为 “详细信息”。)
使用注册表查找当前用户的已安装应用的 AUMID
查询注册表只能返回有关为当前用户安装的 Microsoft Store 应用的信息,而Windows PowerShell查询可以查找设备上任何帐户的信息。
在命令提示符下,键入以下命令:
reg query HKEY_CURRENT_USER\Software\Classes\ActivatableClasses\Package /s /f AppUserModelID | find "REG_SZ"
获取指定用户已安装应用的 AUMID 的示例
下面的代码示例在 Windows PowerShell 中创建一个函数,该函数为指定用户返回已安装应用的 AUMID 数组。
function listAumids( $userAccount ) {
if ($userAccount -eq "allusers")
{
# Find installed packages for all accounts. Must be run as an administrator in order to use this option.
$installedapps = Get-AppxPackage -allusers
}
elseif ($userAccount)
{
# Find installed packages for the specified account. Must be run as an administrator in order to use this option.
$installedapps = Get-AppxPackage -user $userAccount
}
else
{
# Find installed packages for the current account.
$installedapps = Get-AppxPackage
}
$aumidList = @()
foreach ($app in $installedapps)
{
foreach ($id in (Get-AppxPackageManifest $app).package.applications.application.id)
{
$aumidList += $app.packagefamilyname + "!" + $id
}
}
return $aumidList
}
以下Windows PowerShell命令演示如何在创建 listAumids 函数后调用它。
# Get a list of AUMIDs for the current account:
listAumids
# Get a list of AUMIDs for an account named "CustomerAccount":
listAumids("CustomerAccount")
# Get a list of AUMIDs for all accounts on the device:
listAumids("allusers")
获取“开始”菜单中任何应用程序的 AUMID 的示例
下面的代码示例在 Windows PowerShell 中创建一个函数,该函数返回“开始”菜单中当前列出的任何应用程序的 AUMID。
function Get-AppAUMID {
param (
[string]$AppName
)
$Apps = (New-Object -ComObject 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
}
}
以下Windows PowerShell命令演示如何在创建 Get-AppAUMID 函数后调用它。
# 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