New-CMComputerAssociation

Creates an association between two computers in Configuration Manager.

Syntax

New-CMComputerAssociation
   -DestinationComputer <String>
   [-MigrationBehavior <MigrationBehavior>]
   [-MigrationUserName <String[]>]
   -SourceComputer <String>
   [-DisableWildcardHandling]
   [-ForceWildcardHandling]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The New-CMComputerAssociation cmdlet creates an association between two computers to use for migration. Configuration Manager can migrate user state and settings from an existing computer to a different computer as part of operating system deployment. In the course of migration, Configuration Manager saves accounts created on the source computer and creates those user accounts on the destination computer.

To create an association, specify the source computer, the destination computer, and at least one user name created on the source computer to be migrated. You can also specify whether the migration includes other user names from the source computer.

Note

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

Examples

Example 1: Create a computer association

PS XYZ:\> New-CMComputerAssociation -SourceComputer "TSQA073" -MigrationUserName "Contoso-TSQA\ElisaDaugherty" -DestinationComputer "TSQA155"

This command creates a computer association between the source computer named TSQA073 and the destination computer named TSQA155. The command specifies a user name for migration to the destination computer.

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

-DestinationComputer

Specifies the name of a destination computer.

Type:String
Aliases:RestoreName
Position:Named
Default value:None
Required:True
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

-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

-MigrationBehavior

Specifies how Configuration Manager treats user accounts created on the source computer. When you create a computer association, specify user accounts created on the source computer by using the MigrationUserName parameter. The computer association can specify that the migration process creates some or all of those accounts on the destination computer.

The acceptable values for this parameter are:

  • CaptureAllUserAccountsAndRestoreSpecifiedAccounts. Saves all accounts created on the source computer, but creates only the specified accounts on the destination computer.
  • CaptureAndRestoreAllUserAccounts. Saves all accounts created on the source computer, and creates them on the destination computer.
  • CaptureAndRestoreSpecifiedUserAccounts. Saves only the specified accounts from the source computer, and creates those accounts on the destination computer.

If you do not specify a migration behavior, the migration uses CaptureAndRestoreAllUserAccounts.

Type:MigrationBehavior
Accepted values:CaptureAndRestoreAllUserAccounts, CaptureAllUserAccountsAndRestoreSpecifiedAccounts, CaptureAndRestoreSpecifiedUserAccounts
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-MigrationUserName

Specifies an array of user names for accounts created on the source computer. The specified user names, along with the MigrationBehavior parameter setting, determine which user accounts Configuration Manager creates on the destination computer.

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

-SourceComputer

Specifies the name of the source computer.

Type:String
Aliases:SourceName
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 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

IResultObject