Here’s a trick,
You Configure a SCOM 2012 gateway server according to this great article or this one but still after you do the MOMCertImport the gateway is failing to communicate with the SCOM RMS and you see this error on the event viewer:
The OpsMgr Connector connected to SCOM2012, but the connection was closed immediately after authentication occurred. The most likely cause of this error is that the agent is not authorized to communicate with the server, or the server has not received configuration. Check the event log on the server for the presence of 20000 events, indicating that agents which are not approved are attempting to connect.
Apparently the SCOM stores the name of the server in this registry key: “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft Operations Manager\3.0\Server Management Groups\<MG Name>\Parent Health Services\0″
there you find 2 values: