Changing primary management server for agents SCOM 2012

Hello All,

At my SCOM environment I have 2 management servers (MS1 and MS2) and 1 Gateway server (all of them at the same MG).

I have agents connected to MS1 directly and agents connected to the gateway server (on a different domain).

I have a  few questions:

1. Does the agents connected directly to MS1 knows that their failover server is MS2 or I have to set MS2 as a failover server? 

2. I have installed new gateway server in order to replace the old GW server and I want to switch the primary management server for the agents reporting to the old gateway server, do I need to configure both gateways (old and new) as a failover of one anther? or its enough to only change the "primary management server" in the SCOM console? they are remotely manageable.

In the end I want to completely remove the old GW.

Please advise if you can.

Thanks.

August 24th, 2015 3:27am

1) You will have to set up failover of MS and GW Servers through powershell query given here -

http://blogs.technet.com/b/jimmyharper/archive/2010/07/23/powershell-commands-to-configure-gateway-server-agent-failover.aspx

2) after installing new GW , you can change the primary MS of the agents from the console from Old to new GW. Once agents failover to new GW and become healthy. then you can remove the old GW.

Setting up failover MS/GW is used for unplanned outages. since this is a planned activity you can change the failover server from console.

Refer - http://jimmoldenhauer.blogspot.in/2012/11/scom-2012-how-to-remove-management.html

Hope this helps.

Free Windows Admin Tool Kit Click here and download it now
August 24th, 2015 3:56am

Thank you for your quick replay.

If I understand you correctly:

1. There is no need to set a failover between 2 MS, only between MS and GW.

2. I have tried to change primary management server at the console but the result was:

The agents switched primary management server at the console but they where grayed out, when checking the agent configuration you can see it stays on the old GW server.

Please confirm my understanding.. and my problem 

Thanks!

August 24th, 2015 4:03am

Hi

Could you clarify here

"I have tried to change primary management server at the console but the result was:

The agents switched primary management server at the console but they where grayed out, when checking the agent configuration you can see it stays on the old GW server."

Are you trying to move the agents from one management server to another or from a gateway server to a management server?

If the latter, are the GW and MS in the same Kerberos realm?

You also state that the agents are remotely manageable? Did you run a SQL query to set this state?  If so, this does not mean that the agent is really remotely manageable. It just sets a flag in the database to say it is. if the conditions for remotely manageable are not in place then the flag setting will not help.

Regards

Graham

Free Windows Admin Tool Kit Click here and download it now
August 24th, 2015 5:03am

Hello

I am trying to move agents from one GW to another (new one).

I am using the "Change primary management server" option through the SCOM console (administration).

After doing so, I can see at the console (under "managed agents") the agents are under the new GW but grayed out. I connected one of the agents that moved and I can see that the agent configuration (under control panel) is still configure on the old GW.

The agent are remotely manageable because i installed them from the console. not from an SQL query.

Thanks

August 24th, 2015 5:15am

That's clear - I believe you'll need to configure agent failover between gateways using PowerShell. You might be able to use the console to move agents after this but it is not something I have tried.

The Jimmy Harper blog post that was mentioned above is the one to follow:

http://blogs.technet.com/b/jimmyharper/archive/2010/07/23/powershell-commands-to-configure-gateway-server-agent-failover.aspx

"When an Agent is installed and configured to report to a Gateway Server, no failover servers are automatically configured.  So, if the Gateway Server goes down, the Agents will not be able to send any data to the Management Group."

I have always made it part of the deployment \ build process to configure agent --> GW failover as if you lose the GW that is the primary, then you wouldn't be able to communicate with the agent to get it to failover.

You might be able to use the console to failover agents ---> GW after you have configured the agent using PowerShell.

Cheers

Graham

Commands to configure Gateway Agent Failover:

The commands for the Gateway Agent Failover will get all Agents that report to a specified Gateway Server and configure them to be able to failover to another Gateway Server. Replace GATEWAY_1.DOMAIN.COM with the name of the Primary Gateway Server, and replace GATEWAY_2.DOMAIN.COM with the name of the Failover Gateway Server.

#Agents reporting to GATEWAY_1 - Failover to GATEWAY_2     
$primaryMS = Get-SCOMManagementServer | where {$_.Name eq 'GATEWAY_1.DOMAIN.COM'}      
$failoverMS = Get-SCOMManagementServer | where {$_.Name eq 'GATEWAY_2.DOMAIN.COM'}      
$agent = Get-SCOMAgent | where {$_.PrimaryManagementServerName -eq 'GATEWAY_1.DOMAIN.COM'}      
Set-SCOMParentManagementServer -Agent: $agent -PrimaryServer: $primaryMS      
Set-SCOMParentManagementServer -Agent: $agent -FailoverServer: $failoverMS

Commands to verify Gateway Agent Failover:

After configuring the Gateway Agent failover, youll want to verify the configuration. The following PowerShell commands will output the name of each Agent that reports to GATEWAY_1.DOMAIN.COM and its Primary and Failover Gateway Servers:

#Verify Failover for Agents reporting to GATEWAY_1     
$Agents = Get-SCOMAgent | where {$_.PrimaryManagementServerName -eq 'GATEWAY_1.DOMAIN.COM'}      
$Agents | sort | foreach {      
Write-Host "";      
"Agent :: " + $_.Name;      
"--Primary MS :: " + ($_.GetPrimaryManagementServer()).ComputerName;      
$failoverServers = $_.getFailoverManagementServers();      
foreach ($managementServer in $failoverServers) {      
"--Failover MS :: " + ($managementServer.ComputerName);      
}      
}      
Write-Host "";

 

Free Windows Admin Tool Kit Click here and download it now
August 24th, 2015 5:33am

Hello,

Are you sure that I need to run this faileover script between the 2 gateways?

All I want is to navigate the agents from the old GW to a new GW, after that i am deleting the old GW and there is no failover process I want to keep.

Thanks

August 24th, 2015 5:44am

1. If you can choose a "test" server from your list then try changing the GW from the console. Does it work?

2. If not, then try restarting the agent and see if that works.

3 If not, try flushing the agent cache - https://technet.microsoft.com/en-us/library/hh212884.aspx?f=255&MSPPError=-2147217396 - on the agent and see if that works.

If the answer is no to all 3 then configure and run the PowerShell scripts for that test server and see if it works.

I've never run agents without failover capability so can't definitely answer your question but I can understand from the architecture why it might not work from the console.

Cheers

Graham

Free Windows Admin Tool Kit Click here and download it now
August 24th, 2015 5:54am

Hello,

After doing number 3 it worked, but I can't do it to all my 100 agents...

August 24th, 2015 5:57am

I guess you could script it but it would take some time to test.

The other option is try the PowerShell solution on a "test" server. The PowerShell scripts do work.

#Agents reporting to GATEWAY_1 - Failover to GATEWAY_2     
$primaryMS = Get-SCOMManagementServer | where {$_.Name eq 'GATEWAY_1.DOMAIN.COM'}      
$failoverMS = Get-SCOMManagementServer | where {$_.Name eq 'GATEWAY_2.DOMAIN.COM'}      
$agent = Get-SCOMAgent | where {$_.PrimaryManagementServerName -eq 'GATEWAY_1.DOMAIN.COM'}      
Set-SCOMParentManagementServer -Agent: $agent -PrimaryServer: $primaryMS      
Set-SCOMParentManagementServer -Agent: $agent -FailoverServer: $failoverMS

Free Windows Admin Tool Kit Click here and download it now
August 24th, 2015 6:04am

Hi Graham,

I had similar scenario in my environment and I am using the power shell script you mentioned above to failover the agents.

However, at this step:

Set-SCOMParentManagementServer -Agent: $agent -PrimaryServer: $primaryMS

It has been about 1 hr and it's not completed. I had about 100 gateway agents. Please help.

Regards,

Daya 


  • Marked as answer by dorlm 17 hours 0 minutes ago
August 24th, 2015 8:29am

Hi D.R

If this is still running then could you please start a new thread rather than jumping on someone else's - I'll take a look when you post.  

Regards

Graham

Free Windows Admin Tool Kit Click here and download it now
August 24th, 2015 10:12am

Hi Graham,

I had similar scenario in my environment and I am using the power shell script you mentioned above to failover the agents.

However, at this step:

Set-SCOMParentManagementServer -Agent: $agent -PrimaryServer: $primaryMS

It has been about 1 hr and it's not completed. I had about 100 gateway agents. Please help.

Regards,

Daya 


  • Marked as answer by dorlm Monday, August 24, 2015 2:11 PM
August 24th, 2015 12:26pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics