다음을 통해 공유


How to set primary and failover management servers for a gateway [Set-SCOMParentManagementServer failure]

Hello,

unfortunately we have a documentation error in the article where we describe how to use powershell and set the primary and failover management servers for a gateway:

https://technet.microsoft.com/en-us/library/hh920210(v=sc.20).aspx

The issue is we don`t accept for the Set-SCOMParentManagementServer cmdlet 2 parameters, only one at a time. That`s why you will most probably see the following error:

Set-SCOMParentManagementServer: Parameter set cannot be resolved using the specific named parameters.

Rewriting the powershell script, it works like this, just replace the corresponding server names:

Import-Module operationsmanager
New-SCOMManagementGroupConnection -ComputerName "MS1.FQDN"
$pMS=get-scommanagementserver -Name "MS2.FQDN"
$fMS=get-scommanagementserver -Name "MS1.FQDN"

"GW.FQDN" | get-scomgatewaymanagementserver | Set-SCOMParentManagementServer -primaryserver $pMS
"GW.FQDN" | get-scomgatewaymanagementserver | Set-SCOMParentManagementServer  -Failoverserver $fMS

To check if the changes took place you can use:

#Display Primary and Failover Management Servers for all Gateway Servers
$GWs = Get-SCOMManagementServer | where {$_.IsGateway -eq $true}
$GWs | sort | foreach {
Write-Host "";
"Gateway MS :: " + $_.Name;
"--Primary MS :: " + ($_.GetPrimaryManagementServer()).ComputerName;
$failoverServers = $_.getFailoverManagementServers();
foreach ($managementServer in $failoverServers) {
"--Failover MS :: " + ($managementServer.ComputerName);
}
}
Write-Host "";