Disabling SAM and deleting all Licensable data from the Instance

Shantanu1
Tera Guru

Hi Experts!

 

I am fairly new to SAM. We started the SAM implementations and later we recognized it is not much needed and as we had over utilised the SAM SU license Susbcriptions, we are now planning to disable SAM and cleanup all related data in tables like (cmdb_sam_sw_install & samp_sw_subscription ). to avoid over comsumption of Licenses

 

Any help would be greatly appreciated!

 

Thanks,

Shantanu

1 ACCEPTED SOLUTION

Amit Gujarathi
Giga Sage
Giga Sage

HI @Shantanu1 ,
I trust you are doing great.

To disable SAM and clean up the related data, you can follow these steps:

  1. Backup the data: Before performing any changes, it is crucial to take a backup of the tables "cmdb_sam_sw_install" and "samp_sw_subscription" to ensure data integrity. This will serve as a safety net in case any issues arise.

  2. Disable SAM: To disable SAM, you need to navigate to the ServiceNow instance and access the relevant settings. The exact steps may vary depending on your ServiceNow version, but generally, you can follow these instructions:

    • Log in to ServiceNow with an account that has administrative privileges.
    • Go to the System Applications > All Applications module.
    • Search for "Software Asset Management" application.
    • Disable or uninstall the application from the instance.
  3. Cleanup of related data: After disabling SAM, you can proceed with cleaning up the related data from the tables "cmdb_sam_sw_install" and "samp_sw_subscription". This can be achieved through ServiceNow's scripting capabilities, specifically using a script include or a background script. Here's an example of how you can delete records from these tables using a background script:

 

(function () {
  var cmdbSamSwInstallGR = new GlideRecord('cmdb_sam_sw_install');
  cmdbSamSwInstallGR.query();

  while (cmdbSamSwInstallGR.next()) {
    cmdbSamSwInstallGR.deleteRecord();
  }

  var sampSwSubscriptionGR = new GlideRecord('samp_sw_subscription');
  sampSwSubscriptionGR.query();

  while (sampSwSubscriptionGR.next()) {
    sampSwSubscriptionGR.deleteRecord();
  }
})();

 

  • This script creates GlideRecord objects for each table, performs a query to retrieve all records, and then iterates over the result sets to delete each record using the deleteRecord() method.

  • Test and validate: After running the cleanup script, it is recommended to test and validate the changes. Ensure that the records in the "cmdb_sam_sw_install" and "samp_sw_subscription" tables have been successfully removed.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



View solution in original post

2 REPLIES 2

Amit Gujarathi
Giga Sage
Giga Sage

HI @Shantanu1 ,
I trust you are doing great.

To disable SAM and clean up the related data, you can follow these steps:

  1. Backup the data: Before performing any changes, it is crucial to take a backup of the tables "cmdb_sam_sw_install" and "samp_sw_subscription" to ensure data integrity. This will serve as a safety net in case any issues arise.

  2. Disable SAM: To disable SAM, you need to navigate to the ServiceNow instance and access the relevant settings. The exact steps may vary depending on your ServiceNow version, but generally, you can follow these instructions:

    • Log in to ServiceNow with an account that has administrative privileges.
    • Go to the System Applications > All Applications module.
    • Search for "Software Asset Management" application.
    • Disable or uninstall the application from the instance.
  3. Cleanup of related data: After disabling SAM, you can proceed with cleaning up the related data from the tables "cmdb_sam_sw_install" and "samp_sw_subscription". This can be achieved through ServiceNow's scripting capabilities, specifically using a script include or a background script. Here's an example of how you can delete records from these tables using a background script:

 

(function () {
  var cmdbSamSwInstallGR = new GlideRecord('cmdb_sam_sw_install');
  cmdbSamSwInstallGR.query();

  while (cmdbSamSwInstallGR.next()) {
    cmdbSamSwInstallGR.deleteRecord();
  }

  var sampSwSubscriptionGR = new GlideRecord('samp_sw_subscription');
  sampSwSubscriptionGR.query();

  while (sampSwSubscriptionGR.next()) {
    sampSwSubscriptionGR.deleteRecord();
  }
})();

 

  • This script creates GlideRecord objects for each table, performs a query to retrieve all records, and then iterates over the result sets to delete each record using the deleteRecord() method.

  • Test and validate: After running the cleanup script, it is recommended to test and validate the changes. Ensure that the records in the "cmdb_sam_sw_install" and "samp_sw_subscription" tables have been successfully removed.


Was this answer helpful?


Please consider marking it correct or helpful.


Your feedback helps us improve!


Thank you!


Regards,


Amit Gujrathi



Shantanu1
Tera Guru

Thanks Amit for the solution, appreciated!