Page 1 of 1

[SOLVED] Screen search by serial number

Published: November 21, 2024 - 4:50 PM
by Gaetan
Good morning,

in parallel with the use of the package audit-hostI propose this query which allows you to find out which computer a screen is connected to.
Via its serial number.

Code: Select all

/* Remplacer le numéro de série pour trouver la machine*/

SELECT
    h.computer_name,
    h.last_seen_on,
    h.computer_type,
    had.value,
    had.value->'monitors' AS monitors,
    jsonb_path_query(had.value, '$.monitors[*] ? (@.serialno == "SEERIAL_HERE")') IS NOT NULL AS serial_no_found
FROM
    hosts h
INNER JOIN
    hostauditdata had ON h.uuid = had.host_id
WHERE
    h.computer_ad_ou LIKE '%%OU_DE_RECHERCHE%%'
ORDER BY
    h.computer_name ASC
LIMIT 10;

Re: Screen search by serial number

Published: June 25, 2025 - 3:31 PM
by cg_heuliez
Hello, the code above is a query that needs to be created in the "reporting" tab of WAPT, I imagine?
And for it to work, the "audit-host" package needs to be deployed to our entire network?
For the value '%%OU_DE_RECOURCHE%%', should it be: 'Mon_OU', '%Mon_OU%', or '%%Mon_OU%%'?

Re: Screen search by serial number

Published: June 25, 2025 - 4:03 PM
by Gaetan
Hello,

yes, it needs to be created in the reporting section.
The package needs to be applied to the entire fleet.
Be sure to keep the double percent signs (%) to avoid SQL-to-Python interpretation.