Unable to approve Gateways in SCOM 2012

Recently I run into an issue that I can't approve a new Gateway to a SCOM Environment.

As soon as I started the Microsoft.EnterpriseManagement.GatewayApprovalTool.exe I received to following error. 

Microsoft.EnterpriseManagement.gatewayApprovalTool.exe /ManagementServerName=<managementserverFQDN> /GatewayName=<GatewayFQDN> /Action=Create

Microsoft.EnterpriseManagement.GatewayApprovalTool
Copyright (c) Microsoft Corporation. All rights reserved.

The request failed with the following error: Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index

It took me a while to figure out what "index" could be meant, because there was no additional information in Event Log or somewhere else.

Then I figured out that the customer removed the old RMSEmulator role from there SCOM environment, which is fine if no workflow from any third party or custom MPs are targeted to the RMSe instance.

Remember in SCOM 2012 we introduced resource pools and the old Root Management Server has been retired. So there is a possibility now to remove the legacy Root Management emulator instance from SCOM by using PowerShell.
blogs.technet.com/b/momteam/archive/2011/08/22/topology-changes-in-system-center-2012-operations-manager-overview.aspx

If you run into that situation that the geateway approval tool returns an "Index was out of range" error, you can fix it as following:

  1. Test if an RMSe instance exists

    Get-SCOMRMSemulator (If one RMSe exists powershell report the corresponding Management Server.) In this case you can stop here and need to search for another reason) ;-)

  2. Start Operations Manager Powershell

  3. Create a new RMSe instance on any existent management server in your environment.

    Get-SCOMManagementServer –Name <FQDN of Management Server> | Set-SCOMRMSEmulator

  4. Test if the RMSe instance has been created successfully

    Get-SCOMRMSemulator (now you should see your management server)

  5. Run the GatewayApprovalTool to prepare your environment for the new gateway. (Remember that
    needs to be done before you install the gateway itself.)

    Microsoft.EnterpriseManagement.GatewayApprovalTool.exe /ManagementServerName=<managementserverFQDN> /GatewayName=<GatewayFQDN> /Action=Create

  6. If you want to remove the RMSe instance afterwards again, you can do it by running

    Remove-SCOMRMSEmulator

 

Good luck and have fun!