Share via


Set-SCOMParentManagementServer

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

Syntax

FromAgentPrimaryServer (Default)

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

FromAgentFailoverServer

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

FromGatewayManagementServer

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

FromGatewayFailoverManagementServer

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.

Parameter properties

Type:

AgentManagedComputer[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromAgentPrimaryServer
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False
FromAgentFailoverServer
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False

-Confirm

Prompts you for confirmation before running the cmdlet.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:cf

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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".

Parameter properties

Type:

ManagementServer[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromAgentFailoverServer
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False
FromGatewayFailoverManagementServer
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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".

Parameter properties

Type:

ManagementServer[]

Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromGatewayManagementServer
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments:False
FromGatewayFailoverManagementServer
Position:1
Mandatory:True
Value from pipeline:True
Value from pipeline by property name:True
Value from remaining arguments: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

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:3
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-PrimaryServer

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

Parameter properties

Type:ManagementServer
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

FromAgentPrimaryServer
Position:2
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Parameter properties

Type:SwitchParameter
Default value:False
Supports wildcards:False
DontShow:False
Aliases:wi

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

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.