Remove-CMComputerAssociation

Deletes a computer association from Configuration Manager.

Syntax

Remove-CMComputerAssociation
      -DestinationComputer <String>
      [-Force]
      -SourceComputer <String>
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMComputerAssociation
      [-Force]
      -InputObject <IResultObject>
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]
Remove-CMComputerAssociation
      [-Force]
      -MigrationId <String>
      [-DisableWildcardHandling]
      [-ForceWildcardHandling]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-CMComputerAssociation cmdlet deletes a computer association from Configuration Manager. You can specify the association to remove by specifying both computers in the association or by specifying the association ID, or you can use the Get-CMComputerAssociation cmdlet to get an association to remove.

Note

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

Examples

Example 1: Remove an association by using computer names

PS XYZ:\> Remove-CMComputerAssociation -DestinationComputer "West155" -SourceComputer "West073"

This command removes the computer association between the computers named West155 and West073.

Example 2: Remove an association by using an ID

PS XYZ:\> Remove-CMComputerAssociation -MigrationId "MID1207" -Force

This command removes the computer association that has the ID MID1207. This command uses the Force parameter, so the cmdlet does not prompt you for confirmation before it removes the association.

Example 3: Remove an association by using a variable

PS XYZ:\> $CMCA = Get-CMComputerAssociation -MigrationId "MID1207"
PS XYZ:\> Remove-CMComputerAssociation -InputObject $CMCA -Force

The first command gets the computer association that has the ID MID1207, and saves it in the $CMCA variable.

The second command removes the association saved in the $CMCA variable. This command uses the Force parameter, so the cmdlet does not prompt you for confirmation before it removes the association.

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

-Force

Forces the command to run without asking for user confirmation.

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

-InputObject

Specifies a computer association object. To obtain a computer association object, use the Get-CMComputerAssociation cmdlet.

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

-MigrationId

Specifies the ID of a computer association.

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

Microsoft.ConfigurationManagement.ManagementProvider.IResultObject

Outputs

System.Object