Jump to content
MetaMSP

Identifying Non-Functional (non-inventorying) Agents (per CWKB)

Recommended Posts

https://docs.connectwise.com/ConnectWise_Automate/ConnectWise_Automate_Supportability_Statements/How_to_Identify_and_Remove_Nonfunctional_Agents

SELECT DISTINCT
        FilteredComputers.ComputerId,
        (
            (FilteredComputers.`Name` = '') + (FilteredComputers.`OS` = '') + (FilteredComputers.`Version` = '') + (FilteredComputers.`BiosName` = '') + (FilteredComputers.`USB` = '') + (FilteredComputers.`Tape` = '') +
            (FilteredComputers.`Sound` = '') + (FilteredComputers.`SCSI` = '') +
            (FilteredComputers.`Memory` = '') + (FilteredComputers.`Video` = '') + (FilteredComputers.`Processors` = '') + (FilteredComputers.`Nic` = '') + (FilteredComputers.`DNSInfo` = '') +
            (FilteredComputers.`LocalAddress` = '') + (FilteredComputers.`Modems` = '') + (FilteredComputers.`AssetTag` = '')
        ) AS EmptyFieldsCount,
        (FilteredComputers.`Name` = '') AS NameIsEmpty,
        (FilteredComputers.`OS` = '') AS OSIsEmpty,
        (FilteredComputers.`Version` = '') AS VersionIsEmpty,
        (FilteredComputers.`BiosName` = '') AS BiosNameIsEmpty,
        (FilteredComputers.`USB` = '') AS USBIsEmpty,
        (FilteredComputers.`Tape` = '') AS TapeIsEmpty,
        (FilteredComputers.`Sound` = '') AS SoundIsEmpty,
        (FilteredComputers.`SCSI` = '') AS SCSIIsEmpty,
        (FilteredComputers.`Memory` = '') AS MemoryIsEmpty,
        (FilteredComputers.`Video` = '') AS VideoIsEmpty,
        (FilteredComputers.`Processors` = '') AS ProcessorsIsEmpty,
        (FilteredComputers.`Nic` = '') AS NicIsEmpty,
        (FilteredComputers.`DNSInfo` = '') AS DNSInfoIsEmpty,
        (FilteredComputers.`LocalAddress` = '') AS LocalAddressIsEmpty,
        (FilteredComputers.`Modems` = '') AS ModemsIsEmpty,
        (FilteredComputers.`AssetTag` = '') AS AssetTagIsEmpty
FROM (
    SELECT c.*
    FROM computers c
    WHERE ((c.`Name` = '') + (c.`OS` = '') + (c.`Version` = '') + (c.`BiosName` = '') + (c.`USB` = '') + (c.`Tape` = '') +
        (c.`Sound` = '') + (c.`SCSI` = '') +
        (c.`Memory` = '') + (c.`Video` = '') + (c.`Processors` = '') + (c.`Nic` = '') + (c.`DNSInfo` = '') +
        (c.`LocalAddress` = '') + (c.`Modems` = '') + (c.`AssetTag` = '')) >= 12
) AS FilteredComputers
LEFT JOIN Computers c ON
    c.ComputerId NOT IN (SELECT c.ComputerId
    FROM computers c
    WHERE ((c.`Name` = '') + (c.`OS` = '') + (c.`Version` = '') + (c.`BiosName` = '') + (c.`USB` = '') + (c.`Tape` = '') +
        (c.`Sound` = '') + (c.`SCSI` = '') +
        (c.`Memory` = '') + (c.`Video` = '') + (c.`Processors` = '') + (c.`Nic` = '') + (c.`DNSInfo` = '') +
        (c.`LocalAddress` = '') + (c.`Modems` = '') + (c.`AssetTag` = '')) >= 12) AND
    /* Join against computers that are within +/- 2 ComputerIds OR whose date added is within 30 minutes of each other */
    ((c.ComputerId >= FilteredComputers.ComputerId - 2 AND c.ComputerId <= FilteredComputers.ComputerId + 2) OR (c.DateAdded >= DATE_ADD(FilteredComputers.DateAdded, INTERVAL -30 MINUTE) AND c.DateAdded <= FilteredComputers.DateAdded)) AND
    (c.Name = FilteredComputers.Name OR c.MAC = FilteredComputers.MAC) AND
    (c.clientid = FilteredComputers.clientid AND c.locationid = FilteredComputers.locationid)
WHERE c.ComputerId IS NULL;

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...