I ran into a situation where I could not get a gateway server to approve via the Microsoft.EnterpriseManagement.GatewayApprovalTool.exe. It was erroring out saying that "The gateway name already exists as a computer instance.".
After digging into the console (in the computers view), I found that the Nworks management pack had created a "not monitored" computer object for this server because it was a guest operating system running in VMWare and the Nworks management pack had detected the guest system.
I ran across this article which headed me down the path to fixing the situation: (which talks about the gateway approval issue and the MT_Computer table)
Further research led to this article which discussed the tables in OpsMgr and how to identify the specific computer record:
This in turn pointed me to the following link which discussed how to update the IsDeleted record:
With all of this being said, don’t try this unless you have no other options. It can be a really really bad idea to go messing around in the OpsMgr tables and can make your environment unsupported. As this had to be activated I took the following process to get this gateway server approved:
1) Stopped the nworks collector service from within the nworks VIC configuration utility so it would not re-create the non monitored computer object.
2) Identified the record to change with this SQL query: (from the newsgroups)
/* Selecting Discovered Computers that are not monitored */
/* assumes DNSname=NULL means that the entity is unmanaged. */
select mtc.PrincipalName, mtc.NetbiosComputerName,DNSName,
mtc.basemanagedentityid as bid
from OperationsManager.dbo.MT_Computer mtc,
where mtc.basemanagedentityid = bme.basemanagedentityid and
mtc.DNSName is NULL and
bme.IsDeleted = 0
3) Found the BID number and used it in the following query to clear out this record using this SQL query: (from the ops-mgr blog)
SET IsDeleted = 1
where BaseManagedEntityID='<value for the gateway server in the BID identified above>’
4) Re-ran the Gateway approval tool and it ran successfully/no error about the gateway already existing as a computer instance.
5) After the gateway installation process was completed, re-started the nworks collector services which had been stopped in step #1.
My new OpsMgr gateway server is working like a champ!