Add-CMDeviceAffinityToUser

Adds device affinity to a Configuration Manager user.

Syntax

Add-CMDeviceAffinityToUser
   [-Confirm]
   [-DeviceId <String>]
   [-DeviceName <String>]
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   -UserId <String>
   [-WhatIf]
   [<CommonParameters>]
Add-CMDeviceAffinityToUser [-Confirm] [-DeviceId ] [-DeviceName ] [-DisableWildcardHandling]
 [-ForceWildcardHandling] -UserName  [-WhatIf] []

Description

The Add-CMDeviceAffinityToUser cmdlet adds device affinity to a user of Microsoft System Center Configuration Manager.

Device affinity in Configuration Manager associates a user with one or more devices. Instead of deploying applications to all the user's devices, you deploy the application to the user and Configuration Manager automatically installs the application on all devices that are associated with that user. Device affinity removes the need for Configuration Manager to determine the names of the devices of a user before you deploy applications for that user.

For more information about user device affinity, see How to Manage User Device Affinity in Configuration Manager on TechNet.

Examples

Example 1: Add device affinity to a user by user ID

PS C:\>Add-CMDeviceAffinityToUser -UserName "Patti Fuller" -DeviceName "WestDivUpdates05"

This command adds affinity to the device named WestDivUpdates05 for the user named Patti Fuller.

Required Parameters

-UserId

Specifies a user by using an ID.

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

Specifies an array of user names to associate with the device.

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

Optional Parameters

-Confirm

Prompts you for confirmation before running the cmdlet.

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

Specifies a device by using an ID.

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

Specifies a device by using a name.

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

Indicates that wildcard handling is disabled.

Type:SwitchParameter
Required:False
Position:Named
Default value:None
Accept pipeline input:False
Accept wildcard characters:False
-ForceWildcardHandling

Indicates that wildcard handling is enabled.

Type:SwitchParameter
Required:False
Position:Named
Default value:None
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
Required:False
Position:Named
Default value:False
Accept pipeline input:False
Accept wildcard characters:False