- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-17-2025 01:41 AM
I am looking at the software models within our instance as someone in the past had turned of the 'automatically create software models' option. I understand that this is for mature instances of SAM Pro.
As a SAM Manager, this has led me to review the list of software models. We have a number of models that do not have a product listed against them as well as no discovery map listed against them.
As they have no product assigned, does this mean that I can delete them without risk of screwing up something else in SAM Pro. If there is a risk, how do I check?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 03:10 AM
Step 1: Identify Software Models
Start by filtering the Software Models table (cmdb_software_product_model) using criteria such as:
- Product → is empty
- Discovery Map → is empty
- Discovery Source → is empty (optional)
Save this filtered list temporarily for easier batch analysis.
Step 2: Check Entitlements Linked to These Models
In the Software Entitlements table (software_entitlement), filter the entries by:
- Model → [Name of model]
If any entitlement references the model, review the entitlement before proceeding. Do not delete the model yet.
Step 3: Review Installed Software
Go to the Discovered Installations table (cmdb_sam_sw_install) and filter by:
- Software Model → [Name of model]
Check whether the model is linked to any discovered installations. If so, decide whether to reassign them to the proper model or update the discovery map.
Step 4: Check Normalization Rules
In the Normalization Rules table (sam_normalization_rule), filter entries by:
- Model → [Name of model]
Review any rules tied to the model. Removing a model without updating its related normalization rules could cause errors during normalization.
Step 5: Perform a Test Delete in Sub-Production
If you have access to a sub-production environment, test the deletion of one or two unlinked models to confirm there are no downstream impacts.
Step 6: Document and Delete Safely
Only delete a model if you’ve confirmed that:
- It has no product associated.
- It’s not linked to entitlements.
- It’s not tied to discovered installations.
- It’s not referenced in normalization rules.
Before removing the models, document their conditions and reasons for deletion for future reference or in case rollback is needed.
Recommendation
Start with small batches of deletions, monitor reconciliation runs closely, and proceed gradually.
Script (Background Script for Review Only)
Use in a non-prod instance first. This script only identifies — it does not delete.
var gr = new GlideRecord('cmdb_software_product_model');
gr.addNullQuery('product'); // No product
gr.addNullQuery('discovery_map'); // No discovery map
gr.query();
var orphanedModels = [];
while (gr.next()) {
// Check for linked entitlements
var ent = new GlideRecord('software_entitlement');
ent.addQuery('model', gr.sys_id);
ent.query();
// Check for discovered installs
var install = new GlideRecord('cmdb_sam_sw_install');
install.addQuery('software_model', gr.sys_id);
install.query();
// Only add if no entitlements or installs exist
if (!ent.hasNext() && !install.hasNext()) {
orphanedModels.push({
model_name: gr.getValue('name'),
sys_id: gr.getValue('sys_id')
});
}
}
gs.print('Orphaned Models Safe to Delete: ' + JSON.stringify(orphanedModels, null, 2));
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-18-2025 03:10 AM
Step 1: Identify Software Models
Start by filtering the Software Models table (cmdb_software_product_model) using criteria such as:
- Product → is empty
- Discovery Map → is empty
- Discovery Source → is empty (optional)
Save this filtered list temporarily for easier batch analysis.
Step 2: Check Entitlements Linked to These Models
In the Software Entitlements table (software_entitlement), filter the entries by:
- Model → [Name of model]
If any entitlement references the model, review the entitlement before proceeding. Do not delete the model yet.
Step 3: Review Installed Software
Go to the Discovered Installations table (cmdb_sam_sw_install) and filter by:
- Software Model → [Name of model]
Check whether the model is linked to any discovered installations. If so, decide whether to reassign them to the proper model or update the discovery map.
Step 4: Check Normalization Rules
In the Normalization Rules table (sam_normalization_rule), filter entries by:
- Model → [Name of model]
Review any rules tied to the model. Removing a model without updating its related normalization rules could cause errors during normalization.
Step 5: Perform a Test Delete in Sub-Production
If you have access to a sub-production environment, test the deletion of one or two unlinked models to confirm there are no downstream impacts.
Step 6: Document and Delete Safely
Only delete a model if you’ve confirmed that:
- It has no product associated.
- It’s not linked to entitlements.
- It’s not tied to discovered installations.
- It’s not referenced in normalization rules.
Before removing the models, document their conditions and reasons for deletion for future reference or in case rollback is needed.
Recommendation
Start with small batches of deletions, monitor reconciliation runs closely, and proceed gradually.
Script (Background Script for Review Only)
Use in a non-prod instance first. This script only identifies — it does not delete.
var gr = new GlideRecord('cmdb_software_product_model');
gr.addNullQuery('product'); // No product
gr.addNullQuery('discovery_map'); // No discovery map
gr.query();
var orphanedModels = [];
while (gr.next()) {
// Check for linked entitlements
var ent = new GlideRecord('software_entitlement');
ent.addQuery('model', gr.sys_id);
ent.query();
// Check for discovered installs
var install = new GlideRecord('cmdb_sam_sw_install');
install.addQuery('software_model', gr.sys_id);
install.query();
// Only add if no entitlements or installs exist
if (!ent.hasNext() && !install.hasNext()) {
orphanedModels.push({
model_name: gr.getValue('name'),
sys_id: gr.getValue('sys_id')
});
}
}
gs.print('Orphaned Models Safe to Delete: ' + JSON.stringify(orphanedModels, null, 2));