Set-SCOMParentManagementServer

Modifies the primary and failover management servers for an agent or gateway management server.

Syntax

Set-SCOMParentManagementServer
   [-Agent] <AgentManagedComputer[]>
   [-PrimaryServer] <ManagementServer>
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-SCOMParentManagementServer
   [-Agent] <AgentManagedComputer[]>
   [-FailoverServer] <ManagementServer[]>
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-SCOMParentManagementServer
   [-PrimaryServer] <ManagementServer>
   [-GatewayServer] <ManagementServer[]>
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]
Set-SCOMParentManagementServer
   [-GatewayServer] <ManagementServer[]>
   [-FailoverServer] <ManagementServer[]>
   [-PassThru]
   [-WhatIf]
   [-Confirm]
   [<CommonParameters>]

Description

The Set-SCOMParentManagementServer cmdlet modifies the primary and failover management servers for an agent or gateway management server. In System Center - Operations Manager, primary and failover management servers provide redundancy for agents and gateway management servers.

This cmdlet requires an agent object or a gateway management server object, and a management server object. For information about how to get an agent object, type Get-Help Get-SCOMAgent. For information about how to get a gateway management server object, type "Get-Help Get-SCOMGatewayManagementServer".

This cmdlet cannot modify both the primary server and the failover management server in the same command.

Examples

Example 1: Set the primary and failover management servers

$PrimaryMgmtServer = Get-SCOMManagementServer -Name "MS01-2016.contoso.com"
$FailoverMgmtServer = Get-SCOMManagementServer -Name "MS02-2016.contoso.com"
$Agent1 = "AGENT01-2016.contoso.com" | Get-SCOMAgent
$Agent1 | Set-SCOMParentManagementServer -FailoverServer $null | Out-Null
$Agent1 | Set-SCOMParentManagementServer -PrimaryServer $PrimaryMgmtServer -Passthru
$Agent1 | Set-SCOMParentManagementServer -FailoverServer $FailoverMgmtServer -Passthru
$Agent2 = "DC01-2016.contoso.com" | Get-SCOMAgent
$Agent2 | Set-SCOMParentManagementServer -FailoverServer $null | Out-Null
$Agent2 | Set-SCOMParentManagementServer -PrimaryServer $PrimaryMgmtServer -Passthru
$Agent2 | Set-SCOMParentManagementServer -FailoverServer $FailoverMgmtServer -Passthru

The above script sets failover to $null and then proceeds to set the primary and failover servers. This is to prevent any error when setting either the primary or failover server to a server name that is already set in the primary or failover server values for the Agents.

Example 2: Set the gateway primary server and failover server

PS C:\>$PrimaryMgmtServer = Get-SCOMManagementServer -name "MgmtServer01.Contoso.com"
PS C:\> $FailoverMgmtServer = Get-SCOMManagementServer -Name "MgmtServer02.Contoso.com"
PS C:\> "GatewayMgmtServer01.Contoso.com" | Get-SCOMGatewayManagementServer | Set-SCOMParentManagementServer -PrimaryServer $PrimaryMgmtServer
PS C:\> "GatewayMgmtServer01.Contoso.com" | Get-SCOMGatewayManagementServer | Set-SCOMParentManagementServer -FailoverServer $FailoverMgmtServer

This example sets the gateway, primary, and failover parent management servers.

The first two commands use the Get-SCOMManagementServer cmdlet to get a management server to set as the gateway server's primary management server, and a management server to set as the gateway server's failover management server. The commands store the objects in the $PrimaryMgmtServer, and $FailoverMgmtServer variables, respectively.

The third command uses the Get-SCOMGatewayManagementServer cmdlet to get the gateway management server named GatewayMgmtServer01.Contoso.com and pipes the result to the Set-SCOMParentManagementServer cmdlet to set the primary management server specified in the $PrimaryMgmtServer variables for the gateway management server.

The fourth command uses the Get-SCOMGatewayManagementServer cmdlet to get the gateway management server named GatewayMgmtServer01.Contoso.com and pipes the result to the Set-SCOMParentManagementServer cmdlet to set the failover management server specified in the $FailoverMgmtServer variable for the gateway management server.

Example 3: Set the primary management server

PS C:\>Set-SCOMParentManagementServer -Agent (Get-SCOMAgent -Name "Server01.Contoso.com") -PrimaryServer (Get-SCOMManagementServer -Name "MgmtServer01.Contoso.com")

This example sets the primary management server for the specified agent.

The commands in parentheses, which are executed first, get the agent named Server01, and the management server named MgmtServer01. The cmdlet then passes the results of the commands in parentheses to the Set-SCOMParentManagementServer cmdlet, which then sets the primary server for the agent.

Parameters

-Agent

Specifies an array of agent objects. To obtain an AgentManagedComputer object, use the Get-SCOMADAgent cmdlet.

Type:AgentManagedComputer[]
Position:1
Default value:None
Required:True
Accept pipeline input:True
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

-FailoverServer

Specifies an array of management server objects for the agent to use as failover servers. For information about how to get a management server object, type "Get-Help Get-SCOMManagementServer".

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

-GatewayServer

Specifies an array of gateway management server objects. For information about how to get a management server object, type "Get-Help Get-SCOMGatewayManagementServer".

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

-PassThru

Indicates that the cmdlet creates or modifies an object that a command can use in the pipeline. By default, this cmdlet does not generate any output

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

-PrimaryServer

Specifies an array of management server object for the agent to use as its primary server.

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

Notes

  • You cannot modify both the primary and failover management servers in the same command. To modify both, run Set-SCOMParentManagementServer twice, as shown in the examples.