cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Remove Inventory Items from Database

Hi Everyone,

We have an issue where we are running out of licence as Azure Machine that are Rebuild show as a new device.

As this is the case, there is a need for us to remove items from the 'Discovery & Inventory > All Inventory' using the SQL database to automate their removal.

Currently we are removing Inventory Items from the 'Computers_MT' table in SQL but the items remain in the Front End. (Query Below)

USE FNMSInventory IF OBJECT_ID('tempdb..#Computer') IS NOT NULL
DROP TABLE #Computer SELECT ComputerID,ComputerOUID INTO #Computer
FROM Computer WHERE ComputerCN IN ('$Computer') EXEC dbo.DeleteComputers

We are a where that you can remove items using the delete button within the inventory page, but our issue is that items reappear the next day.

Does anyone have any advice or sql that we can use to automate this process?

(1) Reply
mfranz
By Level 17 Champion
Level 17 Champion

Hi,

depending on the inventory type, inventories might originate from FNMSInventory.dbo.Computer. If the source is a cloud adapter, you might need to remove them directly from FNMSCompliance.dbo.ImportedComputer_MT.

You could deploy a trigger to automatically remove devices from FNMSInventory.dbo.Computer and FNMSCompliance.dbo.ImportedComputer_MT when it is removed from FNMSCompliance.dbo.ComplianceComputer_MT. FNMSCompliance.dbo.ComplianceComputerConnection tells how the last 2 tables are related.

It could be that the actual source (Azure) keeps reporting these removed machines. Then you might need to look for another solution to get rid of them.

Best regards,

Markward