
steven_donovan1 asked a question.
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
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 AssetTypePropertyDECLARE @return_value int
DECLARE @ap_propertyName nvarchar(500)OPEN ap_cursor
FETCH ap_cursor into @ap_propertyNameWHILE @@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_cursorTry following statements to delete all custom property definitions:
DELETE FROM dbo.ComplianceUserTypePropertyDELETE FROM dbo.ComplianceComputerTypePropertyDELETE FROM dbo.VMHostPropertyDELETE FROM dbo.PurchaseOrderPropertyDELETE FROM dbo.PurchaseOrderDetailPropertyDELETE FROM dbo.VendorPropertyDELETE FROM dbo.ContractPropertyDELETE FROM dbo.AssetTypePropertyDELETE FROM dbo.SoftwareTitlePropertyDELETE FROM dbo.SoftwareLicenseTypePropertyDELETE FROM dbo.ImportedVMHostPropertyDELETE 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.%'