Loading
Deleting old records from all inventory from 2020 R2 On Premises

I have 37,000 records that were discovered from the Flexnet Inventory Connection that are much older than 90 days. They are ignored but would like to delete the records. What is the best way to remove the records. I have tried deleting them from the WEBUI from all inventory and from discovery but they are still there. I have also deleted all the records that were in out of date inventory.  


  • iamjon (Flexera Software)

    Hello @bottsrm  you can run this script instead to delete Obsolete Inventory within <N> number of days. Just don't forget to set the number of days within the SET @ObsoleteInventoryPeriodInDays = <Days>  where <Days> can be any value from 30, 60, or 90 days.

    1. DECLARE@ObsoleteInventoryPeriodInDays INT = NULLSET @ObsoleteInventoryPeriodInDays = <Days>DECLARE @staleDate datetimeSET @staleDate = dateadd(day,-@ObsoleteInventoryPeriodInDays,DATEDIFF(Day, 0, GetDate()))DECLARE @BatchSize INT = 10CREATE table Computer (ComputerID bigint)WHILE 1 = 1BEGININSERT INTO ComputerSELECT TOP (@BatchSize)c.ComputerID FROM dbo.Computer c INNER JOIN dbo.InventoryReport ir on c.ComputerID = ir.ComputerIDWHERE HWDate < @staleDateBEGIN TRANSACTIONIF EXISTS(SELECT 1 from Computer )exec DeleteComputersCOMMIT TRANSACTIONDELETE FROM ComputerIF @@ROWCOUNT < @BatchSize BREAKENDDROP TABLE Computer

    I hope that helps.

    Expand Post
    Selected as Best
    • I could not find the procedure in 2020 R2. Called dbo.deletecomputers.

      • Make sure you're in the FNMSInventory database rather than the FNMSCompliance database. You're removing the actual data provided by the agent which is stored separately from what is displayed in the UI. Think of it as being similar to removing an outdated machine from SCCM, that removal would flow through to FNMS during the import. We're removing the data from the actual source here (which is why it can keep coming back otherwise).

        Expand Post
    • I did verify I was in the FNMSInventory database on Premises. I even ran a script to search for stored procedures and it returned nothing. Is this procedure in 2020 R2?

      • It's been in every version of FNMS I've used (9.01 through the latest).

         

        In SSMS, open Programmability -> Stored Procedures. From there you can start typing "dbo.deletecomputers" and it should jump you down.

         

        You can also search with the following query: SELECT * FROM sys.objects WHERE type = 'P' AND name = 'DeleteComputers' 

         

         

        Expand Post
  • You have to delete them both from all inventory and from all discovered devices.

    Regards.

  • iamjon (Flexera Software)

    Hello @bottsrm  you can run this script instead to delete Obsolete Inventory within <N> number of days. Just don't forget to set the number of days within the SET @ObsoleteInventoryPeriodInDays = <Days>  where <Days> can be any value from 30, 60, or 90 days.

    1. DECLARE@ObsoleteInventoryPeriodInDays INT = NULLSET @ObsoleteInventoryPeriodInDays = <Days>DECLARE @staleDate datetimeSET @staleDate = dateadd(day,-@ObsoleteInventoryPeriodInDays,DATEDIFF(Day, 0, GetDate()))DECLARE @BatchSize INT = 10CREATE table Computer (ComputerID bigint)WHILE 1 = 1BEGININSERT INTO ComputerSELECT TOP (@BatchSize)c.ComputerID FROM dbo.Computer c INNER JOIN dbo.InventoryReport ir on c.ComputerID = ir.ComputerIDWHERE HWDate < @staleDateBEGIN TRANSACTIONIF EXISTS(SELECT 1 from Computer )exec DeleteComputersCOMMIT TRANSACTIONDELETE FROM ComputerIF @@ROWCOUNT < @BatchSize BREAKENDDROP TABLE Computer

    I hope that helps.

    Expand Post
    Selected as Best
    • Hi JJacildo,

      Thanks for providing this SQL command which I believe to help me more in my current state. However, it appears that it will only allow me to run this once. I tried running on a different day but it gives me an error saying that the object Computer already exists.

      Any thoughts on how I can pass through this?

      Thanks,

       

      Wacky

      Expand Post
      • @jjoaquin  

        You have to make sure that the command "DROP TABLE Computer" was executed at the end.

         

        But, maybe, someone else had also created a Computer table and is working currently with it or hasn't executed the DROP TABLE command at the end.
        Expand Post
10 of 11

Related  Product Forums


                     → Flexera One



                      → Snow Atlas



                      → FlexNet Manager



                      → Snow License Manager



                       → App Broker


       Need help finding an answer?


        Ask a Question →


Loading
Deleting old records from all inventory from 2020 R2 On Premises