How can I delete large amounts of computers from the Symantec Management Platform database?

book

Article ID: 181765

calendar_today

Updated On:

Products

CMDB Solution

Issue/Introduction

 

Resolution

Question: How can I delete large amounts of computers from the Symantec Management Platform database? For example, I want to start fresh with my computer list, but I don't want to create a new database.
Answer: The only way to delete computers from the Symantec Management Platform Console is from right clicking on those to delete and then choosing Delete. (This requires CMDB Solution to be installed.) However, as this can be cumbersome with large amounts of computers to delete (more than 15 highlighted records at once becomes difficult not impossible to then process), the user may find this easier to perform in the database directly. Computers to be deleted can be added to the ItemToDelete table, which is then normally automatically purged about every ten minutes. For example:

USE Symantec_CMDB
INSERT INTO ItemToDelete(Guid, DeleteDate)
SELECT '<GUID>', '<Date/Time>'

Where "<GUID>" is the GUID of the computer to delete and "<Date/Time>" is the deletion date/time (which by doing this manually, is only used as a reference and not the actual date and time that the record will be deleted on).

The question now becomes, "But how do I delete large amounts this way?", as this is only set up to delete one at a time. The user must provide the GUIDs for those computers to delete. Any SQL script that returns the expected GUIDs can be used. For example, if all computers to b deleted have a name that start with "Test", the following could be used:

USE Symantec_CMDB
INSERT INTO ItemToDelete(Guid, DeleteDate)
SELECT '<GUID>', '<Date/Time>'
FROM vComputer
WHERE Name LIKE 'Test%'

The user would want to therefore test the SELECT statement first by itself to be sure it returns the correct computers to delete, then it can be used to insert their GUIDs into the ItemToDelete table.