Set-SCOMParentManagementServer

Set-SCOMParentManagementServer

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

Syntax

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

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

Parameter Set: FromGatewayFailoverManagementServer
Set-SCOMParentManagementServer [-GatewayServer] <ManagementServer[]> [-FailoverServer] <ManagementServer[]> [[-PassThru]] [-Confirm] [-WhatIf] [ <CommonParameters>]

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

Detailed Description

The Set-SCOMParentManagementServer cmdlet modifies the primary and failover management servers for an agent or gateway management server. In System Center 2012 – 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.

Parameters

-Agent<AgentManagedComputer[]>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-FailoverServer<ManagementServer[]>

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.

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByValue, ByPropertyName)

Accept Wildcard Characters?

false

-GatewayServer<ManagementServer[]>

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

Aliases

none

Required?

true

Position?

1

Default Value

none

Accept Pipeline Input?

true (ByValue, ByPropertyName)

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

Aliases

none

Required?

false

Position?

3

Default Value

none

Accept Pipeline Input?

true (ByValue)

Accept Wildcard Characters?

false

-PrimaryServer<ManagementServer>

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

Aliases

none

Required?

true

Position?

2

Default Value

none

Accept Pipeline Input?

true (ByValue, 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: Set primary and failover management servers

This example sets the primary and failover parent management servers.

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

The third command uses the Get-SCOMAgent cmdlet to get the agent named Server01.Contoso.com and passes the result to the Set-SCOMParentManagementServer cmdlet by using the pipeline operator. The command sets the primary and failover management servers specified in the $PrimaryMgmtServer and $FailoverMgmtServer variables. It then uses the PassThru parameter to generate an object. Without the PassThru parameter, Set-SCOMParentManagementServer does not generate any output.

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

Example 2: Set gateway primary server and failover server

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 variable for the gateway management server.

The final command sets the failover management server specified in the $FailoverMgmtServer variable for the gateway management server. For gateway servers, you cannot set the primary and failover servers in the same command.

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

Example 3: Set primary management server

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.

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

Get-SCOMParentManagementServer

Get-SCOMGatewayManagementServer

Get-SCOMAgent

Get-SCOMManagementServer