編輯

共用方式為


Set-AssignedAccess

Configures a user to launch only one app.

Syntax

Set-AssignedAccess
   -UserName <String>
   -AppName <String>
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AssignedAccess
   -UserName <String>
   -AppUserModelId <String>
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AssignedAccess
   -UserSID <String>
   -AppUserModelId <String>
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-AssignedAccess
   -UserSID <String>
   -AppName <String>
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-AssignedAccess cmdlet configures the specified user account so that it can use only one Windows Store app. The user cannot exit the app, sign out, or access any system settings.

If a user is signed-in or the computer has a PS/2 keyboard, you must restart the computer to apply the changes.

To sign out of assigned access, quickly press the left Windows logo key five times.

Assigned Access cmdlets are supported on Windows 10 and Windows 11 client operating systems only.

Examples

Example 1: Set assigned access by SID and app name

PS C:\> Set-AssignedAccess -UserSID "S-1-5-21-523423449-2432423479-234123443-1004" -AppName "CustomApp"

This command configures assigned access by using the user SID and the app name.

Example 2: Set assigned access by user name and AppUserModelID

PS C:\> Set-AssignedAccess -UserName "UserName" -AppUserModelId "microsoft.windowsphotos_8wekyb3d8bbwe!app"

This command configures assigned access by using the user name and AppUserModelID.

Parameters

-AppName

Specifies the name of the installed Windows Store app to use for assigned access. Wildcard characters are accepted.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-AppUserModelId

Specifies the Application User Model ID (AppUserModelID) for the installed Windows Store app to use for assigned access. The AppUserModelID is found in the app's AUMIDs.txt file.

Type:String
Aliases:AUMID
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type:SwitchParameter
Aliases:cf
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-UserName

Specifies the local user account name to use for assigned access. This cannot be a domain account or an administrator account.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-UserSID

Specifies the security identifier (SID) for the local user account to use for assigned access. This account cannot be a domain account or an administrator account.

Type:String
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type:SwitchParameter
Aliases:wi
Position:Named
Default value:False
Required:False
Accept pipeline input:False
Accept wildcard characters:False

Inputs

None.

You cannot pipe input to this cmdlet.

Outputs

Object

Notes

  • To get all the Windows Store apps installed for a user account, use the Get-AppxPackage cmdlet as follows:

Get-AppxPackage -User "username"