steven_donovan1
Level 6

How to remove all custom properties

Hi All, I am working in an environment where someone created a bunch of custom properties on a on-prem FNMS. Is there a stored procedure to clear out all custom properties and go back to default? Thanks, Steve
0 Kudos
2 Replies
DAWN
Flexera
Flexera

You would have to do this for each Object Type - but below is an example that removes all Custom Properties on Assets....

-- delete properties for refresh - get ALL Properties for Assets and delete

DECLARE ap_cursor CURSOR FOR
select distinct PropertyName
from AssetTypeProperty

DECLARE @return_value int
DECLARE @ap_propertyName nvarchar(500)

OPEN ap_cursor
FETCH ap_cursor into @ap_propertyName

WHILE @@FETCH_STATUS=0
BEGIN
EXEC @return_value = [dbo].[DeleteAssetProperty] @ap_propertyName
FETCH NEXT FROM ap_cursor into @ap_propertyName
END

-- Close and deallocate the cursor
CLOSE ap_cursor
DEALLOCATE ap_cursor

0 Kudos
ChrisG
Community Manager Community Manager
Community Manager

Try following statements to delete all custom property definitions:

 

DELETE FROM dbo.ComplianceUserTypeProperty
DELETE FROM dbo.ComplianceComputerTypeProperty
DELETE FROM dbo.VMHostProperty
DELETE FROM dbo.PurchaseOrderProperty
DELETE FROM dbo.PurchaseOrderDetailProperty
DELETE FROM dbo.VendorProperty
DELETE FROM dbo.ContractProperty
DELETE FROM dbo.AssetTypeProperty
DELETE FROM dbo.SoftwareTitleProperty
DELETE FROM dbo.SoftwareLicenseTypeProperty
DELETE FROM dbo.ImportedVMHostProperty
DELETE FROM dbo.ImportedComputerCustomProperty

-- Delete report column definitions for all custom properties.
-- WARNING: This statement should be safe as long as the only custom columns defined are for custom properties.
-- If your environment has other custom columns defined, you may need to consider whether to change the WHERE clause
-- conditions to only delete what you want.
DELETE FROM dbo.ComplianceSearchTypeColumn
WHERE ComplianceSearchTypeColumnID >= 10000 AND ColumnName LIKE '%Custom.%'

 

 

(Did my reply solve the question? Click "ACCEPT AS SOLUTION" to help others find answers faster. Liked something? Click "KUDO". Anything expressed here is my own view and not necessarily that of my employer, Flexera.)