After upgrading to FlexeraOne Scoped App 1.8.4, legacy Software Discovery Models created before the Technopedia Windows and Windows Server product consolidation may no longer be required.
After the snapshot job completes, active Software Installation records should be associated with the newly created Software Discovery Models. However, inactive Software Installation records may continue to reference legacy Discovery Models.
The Discovery Model cleanup script removes only unreferenced legacy Software Discovery Models. It does not delete Software Installation records. If a legacy Discovery Model is still referenced by a Software Installation record, the script retains the Discovery Model to prevent deletion of a referenced record.
1. Run Auto Flush for inactive Software Installation records
Run Auto Flush for Software Installation records that match the following criteria:
- Discovery Source: FlexeraOne
- Active Install: false
- is_deleted: true
Auto Flush removes inactive Software Installation records that may still reference legacy Software Discovery Models.
NOTE: Auto Flush removes only inactive Software Installation records and clears their references to legacy Discovery Models. The cleanup script described in the following steps deletes the unreferenced legacy Software Discovery Models.
2. Create a Scheduled Script Execution
In the Global application scope, create a Scheduled Script Execution (sysauto_script) record.
Use the following name:
Cleanup Stale Windows Software Discovery Models
3. Configure the execution
Set Run to:
On Demand
This ensures that the cleanup runs only after:
- The snapshot job has completed successfully.
- Auto Flush has been completed, where applicable.
- The resulting Software Installation and Discovery Model associations have been validated.
4. Add the cleanup script
Add the following script to the Scheduled Script Execution.
CAUTION: This script deletes records when EXECUTE_DELETION is set to true. For the initial execution, keep the flag set to false and review the complete dry-run output before enabling deletion.
(function() {
// SAFETY FLAG:
// false = Dry run only. No records are deleted.
// true = Delete validated records.
// Set to true only after reviewing and validating the dry-run output.
var EXECUTE_DELETION = false;
var TABLE = 'cmdb_sam_sw_discovery_model';
var PRODUCTS = [
'Windows Server 2016',
'Windows Server 2019',
'Windows Server 2022',
'Windows Server 2025',
'Windows 10',
'Windows 11'
];
var discoveryModel = new GlideRecord(TABLE);
if (!discoveryModel.isValid()) {
gs.error('[Discovery Model Cleanup] Invalid table: ' + TABLE);
return;
}
if (!discoveryModel.isValidField('discovery_source') ||
!discoveryModel.isValidField('norm_product')) {
gs.error(
'[Discovery Model Cleanup] Required fields are missing. Cleanup aborted.'
);
return;
}
var softwareInstall = new GlideRecord('cmdb_sam_sw_install');
if (!softwareInstall.isValid() ||
!softwareInstall.isValidField('discovery_model')) {
gs.error(
'[Discovery Model Cleanup] Unable to validate Software Installation references. Cleanup aborted.'
);
return;
}
discoveryModel.addQuery('discovery_source', 'FlexeraOne');
discoveryModel.addQuery(
'norm_product.prod_name',
'IN',
PRODUCTS.join(',')
);
discoveryModel.query();
gs.info(
'[Discovery Model Cleanup] Mode=' +
(EXECUTE_DELETION ? 'DELETE' : 'DRY RUN') +
' | Total matching Discovery Models=' +
discoveryModel.getRowCount()
);
var deletedCount = 0;
var skippedCount = 0;
while (discoveryModel.next()) {
var productName = '';
var technopediaId = '';
if (!gs.nil(discoveryModel.norm_product)) {
productName =
discoveryModel.norm_product.prod_name.toString();
if (discoveryModel.norm_product.isValidField(
'x_fls_flexeraone_technopedia_id')) {
technopediaId =
discoveryModel.norm_product
.x_fls_flexeraone_technopedia_id
.toString();
}
}
var install = new GlideRecord('cmdb_sam_sw_install');
install.addQuery(
'discovery_model',
discoveryModel.getUniqueValue()
);
install.query();
var referenceCount = install.getRowCount();
gs.info(
'[Discovery Model Cleanup] ' +
'Sys ID=' + discoveryModel.getUniqueValue() +
' | Display Name=' + discoveryModel.getDisplayValue() +
' | Product=' + productName +
' | Technopedia ID=' + technopediaId +
' | Software Installation References=' + referenceCount
);
if (!EXECUTE_DELETION) {
continue;
}
if (referenceCount > 0) {
skippedCount++;
gs.warn(
'[Discovery Model Cleanup] Skipping deletion. ' +
'Discovery Model is still referenced by ' +
referenceCount +
' Software Installation record(s). ' +
'Sys ID=' + discoveryModel.getUniqueValue()
);
continue;
}
discoveryModel.deleteRecord();
deletedCount++;
}
if (EXECUTE_DELETION) {
gs.info(
'[Discovery Model Cleanup] Cleanup completed. ' +
'Deleted=' + deletedCount +
' | Skipped=' + skippedCount
);
} else {
gs.info(
'[Discovery Model Cleanup] DRY RUN completed. ' +
'No records were deleted. Review and validate the output before setting EXECUTE_DELETION=true.'
);
}
})();
5. Review the records targeted by the cleanup
The script identifies Software Discovery Models that meet both of the following conditions:
- Discovery Source: FlexeraOne
- Normalized Product: One of the following products affected by the Technopedia consolidation:
- Windows Server 2016
- Windows Server 2019
- Windows Server 2022
- Windows Server 2025
- Windows 10
- Windows 11
Before processing records, the script validates that the required tables and fields are available. If the required configuration cannot be validated, the cleanup is aborted without deleting records.
Each matching Discovery Model is also checked for references from the Software Installation (cmdb_sam_sw_install) table. A Discovery Model is deleted only when it has zero Software Installation references.
6. Run the cleanup in dry-run mode
For the initial execution, keep:
var EXECUTE_DELETION = false;
Run the Scheduled Script Execution On Demand.
In dry-run mode, no records are deleted. For each matching Software Discovery Model, the script logs:
- Sys ID
- Display Name
- Normalized Product
- Technopedia ID
- Number of Software Installation records referencing the Discovery Model
7. Review and validate the dry-run results
Navigate to:
System Logs > System Log > All
Filter for log messages containing:
[Discovery Model Cleanup]
Confirm that:
- Only FlexeraOne Software Discovery Models are identified.
- Only the affected legacy Windows products are included.
- The expected Discovery Models are returned.
- Records intended for deletion have Software Installation References = 0.
- Any Discovery Model that still has Software Installation references is investigated before proceeding.
8. Enable deletion
After the dry-run results have been reviewed and approved, change:
var EXECUTE_DELETION = false;
to:
var EXECUTE_DELETION = true;
9. Run the cleanup
Run the Scheduled Script Execution again On Demand.
In deletion mode:
- Discovery Models with zero Software Installation references are deleted.
- Discovery Models that are still referenced by one or more Software Installation records are retained and logged as skipped.
- The script logs the final number of records deleted and skipped.
After the cleanup completes:
-
Unreferenced legacy FlexeraOne Software Discovery Models for the affected Windows products are removed.
-
Legacy Discovery Models that remain referenced by Software Installation records are retained to prevent deletion of referenced records.
-
Any retained records are clearly reported in the cleanup logs for further review or remediation.
-
Software Discovery Models created from the consolidated Technopedia data remain available for the current Software Installation records.
Related Articles
Clean up legacy Software Models after upgrading to Flexera One Scoped App 1.8.4 8Number of Views Unable to create workspace following upgrade to FlexNet Code Insight 6.11.3 5Number of Views Duplicate records in the Software Discovery Model table 9Number of Views ServiceNow application properties showing incorrect scoped app version after upgrade 16Number of Views Disable deletion of Discovery Source records in Flexera Integration Scoped App 14Number of Views
Hi, I am Reva - Ask me anything.
No new updates
Thanks for the feedback!
Your feedback has been saved.Rate this response:
Add Additional feedback ( Optional )
Are you sure you want to cancel
the case creation?
Are you sure you want to cancel the case creation?
Are you sure you want to close this case
| Products | Region | Phone Numbers |
|---|---|---|
| FlexNet Operations FlexNet Embedded FlexNet Publisher FlexNet Connect FlexNet Code Insight InstallAnywhere InstallShield |
North America * |
+1 630-332-2513 (toll) +1 877-279-2853 (toll-free in North America) |
| Europe * |
+44 1925 944367 (toll) +44 800 047 8642 (toll-free in Europe) |
|
| Japan * | +81 3-4540-5335 (select option 2) | |
| Australia * |
+61 3 9895 2177 +61 1800 560 603 (toll-free in Australia) |
|
|
Usage Intelligence (formerly
Revulytics) Compliance Intelligence |
Please use the Case Portal to submit your support ticket or reach out to your Revenera contact. | |
Revenera Assistant
Case id: 00001065
Activity: Status change: 2 hours ago