Add-CMDeviceAffinityToUser
Add-CMDeviceAffinityToUser
Adds device affinity to a Configuration Manager user.
Syntax
Parameter Set: AddDeviceAffinityByUserName
Add-CMDeviceAffinityToUser -UserName <String[]> [-DeviceId <String> ] [-DeviceName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Parameter Set: AddDeviceAffinityByUserId
Add-CMDeviceAffinityToUser -UserId <String> [-DeviceId <String> ] [-DeviceName <String> ] [-Confirm] [-WhatIf] [ <CommonParameters>]
Detailed Description
The Add-CMDeviceAffinityToUser cmdlet adds device affinity to a user of Microsoft System Center 2012 SP1 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 (https://go.microsoft.com/fwlink/?linkid=247182) on TechNet.
Parameters
-DeviceId<String>
Specifies a device by using an ID.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-DeviceName<String>
Specifies a device by using a name.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-UserId<String>
Specifies a user by using an ID.
Aliases |
none |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-UserName<String[]>
Specifies an array of user names to associate with the device.
Aliases |
UniqueUserName |
Required? |
true |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-Confirm
Prompts you for confirmation before running the cmdlet.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Required? |
false |
Position? |
named |
Default Value |
false |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
Examples
Example 1: Add device affinity to a user by user ID
This command adds affinity to the device named WestDivUpdates05 for the user named Patti Fuller.
PS C:\> Add-CMDeviceAffinityToUser -UserName "Patti Fuller" -DeviceName "WestDivUpdates05"
Related topics
Approve-CMUserDeviceAffinityRequest
Deny-CMUserDeviceAffinityRequest