teknoglot:

  • Home
  • Home
  • Microsoft
    • Hyper-V
    • OpsMgr 2007
    • SQL 2005
    • SQL 2008
    • Windows XP
    • Windows Vista
    • Windows 2008
  • Linux
    • Fedora 11
    • RedHat ES
    • SLES
    • Ubuntu
  • Code
    • PowerShell
    • VBS
  • Series
    • MP Dev: TG WinAutoSvc
  • Definitions
    • System Center Operations Manager 2007
      • Classes
      • Service Model
      • Singleton
  • Technobabble
Twitter RSS

Replace/Change a Gateway Server

Posted on September 24, 2009 by Sam T
1 CommentLeave a comment

If you are looking into replacing an (or just switching to another primary) Operations Manager 2007 Gateway Server for any reason, there’s a little more to consider than just right-clicking the clients and selecting “Change Primary Management Server” in the Operations Console.
You could end up with agents not being able to connect to the Management Group at all due to a small problem with the order in which Operations Manager do things.

Here’s basically what happens:

  • You tell Operations Manager to change Primary Management Server for AGENTX from GW1 to GW2.
  • The SDK Service (i guess) tells GW1 that “You’re no longer the Primary Management Server for AGENTX”
  • GW1 acknowledges this and stops talking to AGENTX. And I mean Completely stops talking to AGENTX.
  • OpsMgr then tells GW2 to start accepting communication from AGENTX.
  • OpsMgr tries to tell AGENTX that it should talk to GW2 since GW1 won’t listen.

Spotted the problem?
This modus operandi probably works when agents are on the same network and in the same domain where fail-over is sort of automatic. The problem we are facing now is that the server are telling the Gateway to stop accepting communications to and from the agent before the agent is notified that there is a new Gateway server to talk to. The agent will continue to talk to GW1 but will be completely ignored and you will probably start seeing events in the Operations Manager eventlog on GW1 with EventID 20000.

How do I get around this little feature then?

No matter if you found this article after running into the mentioned troubles or if you are googling ahead of time to be prepared, the fix is the same and consists of a few powershell scripts. These scripts are out there allready, but in different contexts, hence this post.

First step: Install the new Gateway

Documentation on this from Microsoft is good enough, but here’s the short version.

  1. Verify name resolution to and from Gateway server and Management Server
  2. Create certificate for the Gateway server
  3. Approve the Gateway server
  4. Install Gateway server
  5. Import certificates on Windows system
  6. Run MOMCertImport.exe on Gateway server to add the certificate into Gateway server configuration
  7. Wait

The wait is for the gateway server to get all needed configuration from RMS and to download all neccesary management packs, run all the discovery scripts and so on. When the Operations Manager event log has calmed down a bit, move to step two.

Second step: Configure Agent Failover

Connect to an Operations Manager Command Shell. Any will do, as long as it’s connected to the correct Management Group.
Then run the following script:

$primaryGW= Get-ManagementServer | where {$_.Name -eq 'GW2.domain.local'}
$failoverGw = Get-ManagementServer | where {$_.Name -eq 'GW1.domain.local'}
$agents = Get-Agent | where {$_.primarymanagementservername -eq 'GW1.domain.local'}
Set-ManagementServer -AgentManagedComputer: $agents -PrimaryManagementServer: $primaryGW -FailoverServer: $failoverGw

Remember to change “GW1.domain.local” to you OLD Gateway servername and “GW2.domain.local” to your NEW Gateway servername.
If you don’t know powershell, this script basically configures all agents using the old Gateway to use the new one as primare, but keep the old one as a fail-over server. The Gateways will still get to know the changes before the agents, but since the old on is still listening to the agents (though, as the fail-over host) it will be able to tell them to go to the new one, GW2.

Categories: OpsMgr 2007, PowerShell | Tags: How-To, OpsMgr, PowerShell, Script

About Sam T

I am a System Management consultant focusing mainly on System Center Operations Manager, System Center Opalis some Microsoft SQL Server and OP5. Besides doing consulting I am also an MCT and are holding both the official System Center Operations Manager courses at all levels (50028, 50216, 50231) at Cornerstone and Global Knowledge and holds customized classes at customer sites.
View all posts by Sam T→
Notice: This work is licensed under a BY-NC-SA. Permalink: Replace/Change a Gateway Server
SQL ManagementPack Survey – Make your voice heard
My impression of EXT4 — WTH!?

One Response to “Replace/Change a Gateway Server”

  1. [ Teknoglot ] » Change Gateway Powershell Script says:
    March 31, 2010 at 15:30

    [...] This script has pretty much already been covered in my previous post about Changing or Replacing an Operations Manager Gateway Server. [...]

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

*

*


question razz sad evil exclaim smile redface biggrin surprised eek confused cool lol mad twisted rolleyes wink idea arrow neutral cry mrgreen

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

  • kaTWEET!

    • @joe_elway hehe, true. Bridgeways has always been a set-and-forget operation on my experience. Interesting to hear though.
  • Categories

    • Code
      • PowerShell
      • VBS
    • Linux
      • Fedora 11
      • RedHat ES
      • SLES
      • Ubuntu
    • Microsoft
      • Hyper-V
      • OpsMgr 2007
      • OpsMgr 2012
      • SQL 2005
      • SQL 2008
      • Windows 2008
      • Windows Vista
      • Windows XP
    • Technobabble
  • Recent Posts

    • Load-balanced SCOM2012 SDK Services for Network Illiterates [#opsmgr, #nlb]
    • Quick-Hack: Send SMS through Powershell [#powershell]
    • Rant – The Concept of Booth-Babes
    • Parameter Replacement in AlertName
    • Virtual OpenVPN Server at Home
  • Recent Comments

    • Sam T on “Load Balancing” Powershell Script for Operations Manager
    • ChrisAbel on “Load Balancing” Powershell Script for Operations Manager
    • pandora vpn on Virtual OpenVPN Server at Home
    • Giulise on Installing SQL Reporting Services 2005 on Windows 2008 x64
    • Sam T on Bulk disable ACS Forwarders (with wildcards)
© teknoglot:. Proudly Powered by WordPress | Nest Theme by YChong