The Community is now in read-only mode to prepare for the launch of the new Flexera Community. During this time, you will be unable to register, log in, or access customer resources. Click here for more information.
May 07, 2019 02:18 AM
The only built-in process I can think of that deletes inventory gathered by the FlexNet agent is the Active Directory import process: when a computer object is deleted or disabled in Active Directory, the associated inventory will be deleted from the inventory database (and subsequently the inventory device in the compliance database will also be removed on the next inventory import operation). Inventory associated with computers that are not in any Active Directory domain that is imported into FlexNet will never be deleted--it will just age gracefully in place.
If you are willing to go beyond built-in deletion processes and are using FlexNet on-premises (not cloud), the following SQL script is something that you may want to consider running on a regular basis. This script seeks to delete details about computers that have not been heard from for 90 days or more.
-- Delete computer inventory records where no data has been received for at least a set number of days. -- Run this script on the FlexNet inventory database. -- The script works with FlexNet releases at least between 2017 R2 and 2019 R1. It is likely to work with at least some future releases. DECLARE @OldestDataDate DATE SET @OldestDataDate = DATEADD(d, -90, GETDATE()) SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED SET DEADLOCK_PRIORITY LOW DECLARE @TenantID INT DECLARE @TenantName NVARCHAR(256) DECLARE c CURSOR FOR SELECT TenantID, TenantName FROM dbo.Tenant OPEN c FETCH NEXT FROM c INTO @TenantID, @TenantName WHILE @@FETCH_STATUS = 0 BEGIN PRINT N'Deleting inactive computers in tenant ' + @TenantName EXEC dbo.SetTenantID @TenantID WHILE 1 = 1 BEGIN IF OBJECT_ID('tempdb..#Computer') IS NOT NULL DROP TABLE #Computer SELECT TOP 100 c.ComputerID -- Delete in small batches to avoid locking too much data for too long INTO #Computer FROM dbo.Computer c LEFT OUTER JOIN dbo.ComputerResourceData AS crd ON crd.ComputerUID = c.ComputerUID WHERE ( -- Computer is not in Active Directory c.GUID IS NULL -- Or some data has been received about the computer OR crd.ComputerResourceID IS NOT NULL OR EXISTS(SELECT 1 FROM dbo.InventoryReport inr WHERE inr.ComputerID = c.ComputerID) OR EXISTS(SELECT 1 FROM dbo.Installation i WHERE i.ComputerID = c.ComputerID AND i.OrganizationID = c.ComputerOUID) OR EXISTS(SELECT 1 FROM dbo.ComputerUsage cu WHERE cu.ComputerID = c.ComputerID) ) -- But the data is old AND (crd.ComputerUID IS NULL OR NOT(crd.LastUpdated >= @OldestDataDate)) AND NOT EXISTS( SELECT 1 FROM dbo.InventoryReport inr WHERE inr.ComputerID = c.ComputerID AND ( HWDate >= @OldestDataDate OR SWDate >= @OldestDataDate OR FilesDate >= @OldestDataDate OR ServicesDate >= @OldestDataDate OR VMwareServicesDate >= @OldestDataDate OR OVMMDate >= @OldestDataDate OR AccessDate >= @OldestDataDate ) ) AND NOT EXISTS( SELECT 1 FROM dbo.ServiceProvider sp WHERE sp.ComputerID = c.ComputerID AND LastInventoryDate >= @OldestDataDate ) AND NOT EXISTS( SELECT 1 FROM dbo.Installation i WHERE i.ComputerID = c.ComputerID AND i.OrganizationID = c.ComputerOUID AND Received >= @OldestDataDate ) AND NOT EXISTS( SELECT 1 FROM dbo.ComputerUsage cu WHERE cu.ComputerID = c.ComputerID AND LastReported >= @OldestDataDate ) DECLARE @Count INT SET @Count = @@ROWCOUNT IF @Count = 0 BREAK PRINT 'Deleting ' + CAST(@Count AS VARCHAR) + ' computers' EXEC dbo.DeleteComputers END PRINT 'No more computers found to delete' FETCH NEXT FROM c INTO @TenantID, @TenantName END CLOSE c DEALLOCATE c
If you are using FlexNet release 2017 R1 or earlier, try the following version of the script:
-- Delete computer inventory records where no data has been received for at least a set number of days. -- Run this script on the FlexNet inventory database. -- The script works with FlexNet releases at least between 2015 R1 and 2017 R1. It may work with some prior releases, but will not work correct with newer releases. DECLARE @OldestDataDate DATE SET @OldestDataDate = DATEADD(d, -90, GETDATE()) SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED SET DEADLOCK_PRIORITY LOW DECLARE @TenantID INT DECLARE @TenantName NVARCHAR(256) DECLARE c CURSOR FOR SELECT TenantID, TenantName FROM dbo.Tenant OPEN c FETCH NEXT FROM c INTO @TenantID, @TenantName WHILE @@FETCH_STATUS = 0 BEGIN PRINT N'Deleting inactive computers in tenant ' + @TenantName EXEC dbo.SetTenantID @TenantID WHILE 1 = 1 BEGIN IF OBJECT_ID('tempdb..#Computer') IS NOT NULL DROP TABLE #Computer SELECT TOP 100 c.ComputerID -- Delete in small batches to avoid locking too much data for too long INTO #Computer FROM dbo.Computer c WHERE ( -- Computer is not in Active Directory c.GUID IS NULL -- Or some data has been received about the computer OR EXISTS(SELECT 1 FROM dbo.InventoryReport inr WHERE inr.ComputerID = c.ComputerID) OR EXISTS(SELECT 1 FROM dbo.Installation i WHERE i.ComputerID = c.ComputerID AND i.OrganizationID = c.ComputerOUID) OR EXISTS(SELECT 1 FROM dbo.ComputerUsage cu WHERE cu.ComputerID = c.ComputerID) ) -- But the data is old AND NOT EXISTS( SELECT 1 FROM dbo.InventoryReport inr WHERE inr.ComputerID = c.ComputerID AND ( HWDate >= @OldestDataDate OR SWDate >= @OldestDataDate OR FilesDate >= @OldestDataDate OR ServicesDate >= @OldestDataDate OR VMwareServicesDate >= @OldestDataDate OR OVMMDate >= @OldestDataDate OR AccessDate >= @OldestDataDate ) ) AND NOT EXISTS( SELECT 1 FROM dbo.ServiceProvider sp WHERE sp.ComputerID = c.ComputerID AND LastInventoryDate >= @OldestDataDate ) AND NOT EXISTS( SELECT 1 FROM dbo.Installation i WHERE i.ComputerID = c.ComputerID AND i.OrganizationID = c.ComputerOUID AND Received >= @OldestDataDate ) AND NOT EXISTS( SELECT 1 FROM dbo.ComputerUsage cu WHERE cu.ComputerID = c.ComputerID AND LastReported >= @OldestDataDate ) DECLARE @Count INT SET @Count = @@ROWCOUNT IF @Count = 0 BREAK PRINT 'Deleting ' + CAST(@Count AS VARCHAR) + ' computers' EXEC dbo.DeleteComputers END PRINT 'No more computers found to delete' FETCH NEXT FROM c INTO @TenantID, @TenantName END CLOSE c DEALLOCATE c
May 07, 2019 06:20 AM - edited May 28, 2019 04:32 AM
Some of the discussion in this thread has now been obsoleted by the new functionality discussed in the following post: Auto-cleanup of Obsolete FlexNet Inventory.
Jan 24, 2022 12:01 AM
Apr 26, 2021 08:32 AM
The "inventory" database that contains the DeleteComputer(s) stored procedures and the data being discussed in this thread only contains inventory gathered from the FlexNet agent. Data imported from other systems such as SCCM is not stored in this database - that data only appears in the "compliance" database. So if you delete records from the inventory database then you can be confident you are not deleting inventory that has been received from any other source.
Apr 27, 2021 11:38 PM
May 05, 2021 07:32 AM
Is there any API provided by Flexera for deleting the out of date devices completely ? so that the licenses associated with these devices will be released.
Mar 10, 2020 04:18 AM
@aditikumarrout - If you change the status of an Inventory Device from "Active" to "Ignored", the software applications on that device will not consume against any software licenses.
Mar 10, 2020 05:50 AM
@kclausen, Thanks for the information.
We also tried with this option but the device will still be appeared everywhere i.e. in All Inventory and Ignored Inventory.
Actually we have the list retired machine details and only need to remove / delete these machine details from FNMS in such a way that the licenses associated with these machines will be released properly.
Is there any proper way i.e. any API or stored procedure provided by Flexera to achieve this ?
Mar 10, 2020 08:34 AM
@aditikumarrout - If you look at all of the comments on this post, there are some comments that contain the raw SQL scripts that can be run if you wish to physically delete inventory devices from FlexNet Manager On-Premises.
Mar 10, 2020 08:51 AM
@kclausen, I have gone through the SQL scripts and seems like DeleteComputer stored procedure is being used to delete the devices.
Wanted to confirm that, running the DeleteComputer stored procedure directly to delete the single device for test wouldn't have any adverse effect on the FNMS database ?
Thank you.
Mar 10, 2020 09:00 AM
I can't think of any obviously reason why the DeleteComputer stored procedure to delete data for a computer record for testing would have adverse affects.
In case you didn't pick it up from other comments, this is a stored procedure in the inventory database (not the compliance database). It will delete data about the computer gathered by the inventory agent. If you have a different inventory source (such as SCCM) then this stored procedure won't help you. You should look to delete the computer record from the source database in that case.
Mar 11, 2020 01:44 AM
We have run the stored procedure DeleteComputer of InventoryManager database for some devices, those which were available in out of date inventory page and then did reconciliation, we found that these devices were not removed from this page.
We would like to understand that which processes/procedures gets executed once we click the “Delete” button on out of date inventory page of FNMS.
Thank you.
Mar 19, 2020 08:18 AM
This is an extensive community thread with a lot of different information about cleaning up inventory from various databases and sources.
If you ask specifically about deleting inventory devices from the out of data inventory page from within the UI it will delete the devices from the compliance database only (AFAIK). I.e. the devices may reappear after the nightly inventory import and reconcile if they're still in either of the inventory sources as described by others in this thread.
Thanks,
Mar 30, 2020 06:34 AM
As per FNMS 2017R2 Release Notes, Page No:7 It has been mentioned that deleting the device from All Inventory will delete it from All discovered and Inventory DB as well. Below is the URL & Attached is the screenshot for reference. By anychance it got changed on the later versions?
We are on 2019R2 muti tenant environment, but it is not working like it is mentioned. it is just deleting inventory from compliance DB. No other Inventory source, inventory is from Agent only.
Thank you
Sasi
Apr 02, 2020 06:28 AM
I would recommend you open a support case to track it, if you believe that you've found a 'bug'.
Thanks,
Apr 14, 2020 04:16 AM
Some of the discussion in this thread has now been obsoleted by the new functionality discussed in the following post: Auto-cleanup of Obsolete FlexNet Inventory.
Jan 24, 2022 12:01 AM
Does this script will work in FNMS 2023 R2 version ?
In case we don't want to delete those computer is it possible we just mark them as Ignored ?
Can you please share the script we can run to change status from active to ignore for greater than 90 days not inventoried
Oct 09, 2024 03:22 AM
With 2023 R2 you can automatically delete Flexera Inventory over 90 days with a setting if that is desired. Please review the following documentation on how to do so:
IT Asset Management Online Help - IT Asset Management Settings: Inventory Tab (flexera.com)
It is also discussed in the post linked by Chris G above.
If you want to simply mark them as Ignored, you can do that via a Business Adapter.
Oct 09, 2024 12:58 PM