Import-CMUserDeviceAffinity

Imports a file that contains user and device affinities to Configuration Manager.

Syntax

Import-CMUserDeviceAffinity
      [-EnableColumnHeading <Boolean>]
      -FileName <String>
      [-MappingOrder <Mapping[]>]
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Import-CMUserDeviceAffinity cmdlet imports a file that contains user and device affinities to Configuration Manager. User device affinity in Configuration Manager is a method of associating a user with one or more specified devices.

The devices listed in the file that you specify in the FileName parameter must already exist as resources in the Configuration Manager database. If they do not exist, the import will fail.

Note

Run Configuration Manager cmdlets from the Configuration Manager site drive, for example PS XYZ:\>. For more information, see getting started.

Examples

Example 1: Import a user device affinity

PS XYZ:\>Import-CMUserDeviceAffinity -FileName "Remote_Users.csv" -EnableColumnHeadings $True

This command imports the user device affinity in the file named Remote_Users.csv. The EnableColumnHeadings parameter specifies that the import file has column headings for reference purposes.

Parameters

-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

-DisableWildcardHandling

This parameter treats wildcard characters as literal character values. You can't combine it with ForceWildcardHandling.

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

-EnableColumnHeading

Type:Boolean
Aliases:EnableColumnHeadings
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-FileName

Specifies a .csv file that contains a list of users and devices you want to create an affinity between. Each user and device pair must be on a separate line separated by a comma. Use the format <Domain>\<user name>,<device NetBIOS name>.

Type:String
Aliases:FilePath, ImportFilePath, Path
Position:Named
Default value:None
Required:True
Accept pipeline input:False
Accept wildcard characters:False

-ForceWildcardHandling

This parameter processes wildcard characters and may lead to unexpected behavior (not recommended). You can't combine it with DisableWildcardHandling.

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

-MappingOrder

Type:Mapping[]
Aliases:MappingOrders
Accepted values:Users, Devices, Ignored
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet doesn't run.

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

Inputs

None

Outputs

System.Object