Remove-CMComputerAssociation

Remove-CMComputerAssociation

Deletes a computer association from Configuration Manager.

Syntax

Parameter Set: SearchByNameMandatory
Remove-CMComputerAssociation -DestinationComputer <String> -SourceComputer <String> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: SearchByIdMandatory
Remove-CMComputerAssociation -MigrationId <String> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]

Parameter Set: SearchByValueMandatory
Remove-CMComputerAssociation -InputObject <IResultObject> [-Force] [-Confirm] [-WhatIf] [ <CommonParameters>]

Detailed Description

The Remove-CMComputerAssociation cmdlet deletes a computer association from Microsoft System Center 2012 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.

Parameters

-DestinationComputer<String>

Specifies the name of a destination computer.

Aliases

RestoreName

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-Force

Removes a computer association without prompting you for confirmation. By default, the cmdlet prompts you for confirmation before it proceeds.

Aliases

none

Required?

false

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-InputObject<IResultObject>

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

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-MigrationId<String>

Specifies the ID of a computer association.

Aliases

none

Required?

true

Position?

named

Default Value

none

Accept Pipeline Input?

True (ByPropertyName)

Accept Wildcard Characters?

false

-SourceComputer<String>

Specifies the name of the source computer.

Aliases

SourceName

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: Remove an association by using computer names

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

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

Example 2: Remove an association by using an ID

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.

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

Example 3: Remove an association by using a variable

This example removes a computer association that has the ID MID1207.

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.

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

Get-CMComputerAssociation

New-CMComputerAssociation

Set-CMComputerAssociation