此 Windows Management Instrumentation (WMI) 提供程序类配置设置已分配的访问。This Windows Management Instrumentation (WMI) provider class configures settings for assigned access.


class WEDL_AssignedAccess {
    [Key] string UserSID;
    [Read, Write] string AppUserModelId;
    [Read] sint32 Status;


下表列出的任何方法和属于此类的属性。The following tables list any methods and properties that belong to this class.


此类包含任何方法。This class contains no methods.


属性Property 数据类型Data type 限定符Qualifiers 描述Description




你想要用作已分配的访问帐户的用户帐户安全标识符 (SID)。The security identifier (SID) for the user account that you want to use as the assigned access account.



[读取、 写入][read, write]

应用程序用户模型 ID (AUMID) 的 Windows 应用以启动已分配的访问帐户。The Application User Model ID (AUMID) of the Windows app to launch for the assigned access account.




指示已分配的访问配置的当前状态:Indicates the current status of the assigned access configuration:

Value 描述Description


配置有效的帐户,但指定没有任何 Windows 应用。A valid account is configured, but no Windows app is specified. 未启用已分配的访问。Assigned access is not enabled.


启用已分配的访问。Assigned access is enabled.


UserSID 错误: 找不到帐户。UserSID error: cannot find the account.


UserSID 错误: 帐户配置文件不存在。UserSID error: the account profile does not exist.


AppUserModelID 错误: 找不到 Windows 应用。AppUserModelID error: cannot find the Windows app.


任务计划程序错误:无法计划任务。Task Scheduler error: Could not schedule task. 请确保任务计划程序服务正在运行。Make sure that the Task Scheduler service is running.


未指定的错误。Unspecified error.


更改已分配的访问不会影响当前登录; 任何会话你必须注销并重新登录。Changes to assigned access do not affect any sessions that are currently signed in; you must sign out and sign back in.


以下 Windows PowerShell 脚本演示了如何使用此类设置了一个已分配的访问帐户。The following Windows PowerShell script demonstrates how to use this class to set up an assigned access account.

#---Define variables---

$COMPUTER = "localhost"
$NAMESPACE = "root\standardcimv2\embedded"

# Define the assigned access account. 
# To use a different account, change $AssignedAccessAccount to a user account that is present on your device.

$AssignedAccessAccount = "KioskAccount"

# Define the Windows app to launch, in this example, use the Application Model User ID (AUMID) for Windows Calculator.
# To use a different Windows app, change $AppAUMID to the AUMID of the Windows app to launch.
# The Windows app must be installed for the account.

$AppAUMID = "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App"

#---Define helper functions---

function Get-UsernameSID($AccountName) {

# This function retrieves the SID for a user account on a machine.
# This function does not check to verify that the user account actually exists.

    $NTUserObject = New-Object System.Security.Principal.NTAccount($AccountName)
    $NTUserSID = $NTUserObject.Translate([System.Security.Principal.SecurityIdentifier])

    return $NTUserSID.Value

#---Set up the new assigned access account---

# Get the SID for the assigned access account.

$AssignedAccessUserSID = Get-UsernameSID($AssignedAccessAccount)

# Check to see if an assigned access account is already set up, and if so, clear it.

$AssignedAccessConfig = get-WMIObject -namespace $NAMESPACE -computer $COMPUTER -class WEDL_AssignedAccess

if ($AssignedAccessConfig) {

# Configuration already exists.  Delete it so that we can create a new one, since only one assigned access account can be set up at a time.



# Configure assigned access to launch the specified Windows app for the specified account.

Set-WmiInstance -class WEDL_AssignedAccess -ComputerName $COMPUTER -Namespace $NAMESPACE -Arguments @{
        UserSID = $AssignedAccessUserSID;
        AppUserModelId = $AppAUMID
        } | Out-Null;

# Confirm that the settings were created properly.

$AssignedAccessConfig = get-WMIObject -namespace $NAMESPACE -computer $COMPUTER -class WEDL_AssignedAccess

if ($AssignedAccessConfig) {

    "Set up assigned access for the " + $AssignedAccessAccount + " account."
    "  UserSID = " + $AssignedAccessConfig.UserSid
    "  AppModelId = " + $AssignedAccessConfig.AppUserModelId

} else {

    "Could not set up assigned access account."


Windows EditionWindows Edition 支持Supported
Windows 10 家庭版Windows 10 Home No
Windows 10 专业版Windows 10 Pro Yes
Windows 10 企业版Windows 10 Enterprise Yes
Windows 10 教育版Windows 10 Education Yes