Remove-SCAdvisorAgent

Removes one or more agents from the group of agents that report to the Advisor Connector.

Syntax

Remove-SCAdvisorAgent
      [-InputObjects <PartialMonitoringObject[]>]
      [-SCSession <Connection[]>]
      [-ComputerName <String[]>]
      [-Credential <PSCredential>]
      [-WhatIf]
      [-Confirm]
      [<CommonParameters>]

Description

The Remove-SCAdvisorAgent cmdlet removes one or more agents from the group of agents that report to the System Center Advisor Connector.

Examples

Example 1: Remove agents by name from a group of computers

PS C:\> $WindowsComputers = Get-SCClass -Name "Microsoft.Windows.computer" | Get-SCOMClassInstance | Where {$_.Name.Contains("ContosoAgent")}
PS C:\> Remove-SCAdvisorAgent -InputObjects $WindowsComputers

The first command uses the Get-SCClass cmdlet to get all the Windows-based computers, passes those computers to the Get-SCOMClassInstance cmdlet by using the pipeline operator, and then uses the Where-Object cmdlet to find computers that contain the name ContosoAgent. The command stores these instances in the $WindowsComputers variable. For more information, type Get-Help Where-Object.

The second command removes all the agents that are stored in $WindowsComputers from the group of agents that report to the Advisor Connector.

Example 2: Remove agents by name from a computer

PS C:\> $WindowsComputers = Get-SCClass -Name "Microsoft.Windows.computer" | Get-SCOMClassInstance -ComputerName "Computer062" | Where {$_.Name.Contains("ContosoAgent")}
PS C:\> Remove-SCAdvisorAgent -InputObjects $WindowsComputers -ComputerName "Computer062"

The first command uses Get-SCClass to get all the Windows-based computers, passes those computers to Get-SCOMClassInstance by using the pipeline operator to find Computer062, and then uses Where-Object to find agents that contain the name ContosoAgent. The command stores these instances in the $WindowsComputers variable.

The second command removes all the Windows-based computers that are stored in $WindowsComputers from the group of agents that report to the Advisor Connector.

Parameters

-ComputerName

Specifies an array of names of computers. The cmdlet establishes temporary connections with management groups for these computers. You can use NetBIOS names, IP addresses, or fully qualified domain names (FQDNs). To specify the local computer, type the computer name, localhost, or a dot (.).

The System Center Data Access service must be active on the computer. If you do not specify a computer, the cmdlet uses the computer for the current management group connection.

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

-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

-Credential

Specifies the user account under which the management group connection runs. Specify a PSCredential object, such as one that the Get-Credential cmdlet returns, for this parameter. For more information about credential objects, type Get-Help Get-Credential.

If you specify a computer in the ComputerName parameter, use an account that has access to that computer. The default is the current user.

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

-InputObjects

Specifies an array of computer names to opt out from the Advisor Connector.

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

-SCSession

Specifies an array of Connection objects. To get Connection objects, use the Get-SCOMManagementGroupConnection cmdlet.

If this parameter is not specified, the cmdlet uses the active persistent connection to a management group. Use the SCSession parameter to specify a different persistent connection. You can create a temporary connection to a management group by using the ComputerName and Credential parameters. For more information, type Get-Help about_OpsMgr_Connections.

Type:Connection[]
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 is not run.

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