Problem changing the Primary Management Server
When you need to change the primary Management Server, but are having problems with your agents going off line (see the post below on changing Primary Management Server), I have found two ways to get around the issues. Both are doing the same thing.
To start here is what we have to accomplish:
The agent needs to be reinstalled and the agent cache needs to be dumped (however the health service has to be stopped in order to do this).
The fastest way I have found to do this is to change the primary management server in the admin node, then right after (make sure you do this quickly), right click on the agent and select repair. When you select repair the agent is reinstalled, and since we first changed the primary management server the agent is reinstalled using the new management server as its primary (you can verify this by checking in Add/Remove programs of the agent). You still have the problem of the Health Service State cache. The cache has to be dumped, as it still contains the xml file that points to the old gateway or management server. So by opening a remote management console you can stop the health service, then browse to the Health Service State directory on the agent and dump the cache. If you aren’t familiar with this process, it’s very straight forward. The directory (%program files%\System Center Operations Manager 2007\Health Service State\) contains files and folders related to the Health Service (things like downloaded partial MPs, state information, as well as an XML file that contains configuration information (most notably the agent’s primary management server)). All files and folders in this directory can be safely deleted. Once they have been deleted restart the health service (you’ll see the files and folders will reappear once the service has fully started). The agent will go from grayed out to Green and monitored in the Admin console.
The second way to accomplish this task is to start by changing the primary management server in the admin console. Then RDP to the Agent, open the Add/Remove programs applet and select the System Center Operations Manager 2007 Agent, select Change and walk through the menu. On the screen that contains the Management Group information and management server enter the name of the new Primary management server. Once you have finished walking through the menu, stop the Health Service and clear the Health Service State Cache (see instructions above).

Read the complete post at http://david-stclair.spaces.live.com/Blog/cns!112A71B19678F08D!255.entry