Good day All, I need your expertise to accomplish the following mission related to BigFix Inventory.
A HW scan creates multiple output .xml files in C:\Program Files (x86)\BigFix Enterprise\BES Client\LMT\CIT\tlm_hw_scans directory.
12/01/2020 08:15 PM 1,675 tlm_hw_202012011715_1606871717.xml
12/09/2020 12:54 PM 1,671 tlm_hw_202012020908_1606918131.xml
12/09/2020 12:48 PM 1,631 tlm_hw_202012020908_1606918165.xml
12/09/2020 01:22 PM 1,675 tlm_hw_202012091322_1607538129.xml
I am looking for a relevance script to extract the Serial Number from ONLY the latest copy of the above .xml file which is this one below based on the date and time.
12/09/2020 01:22 PM 1,675 tlm_hw_202012091322_1607538129.xml
This is important as Serial Number value could be different when dealing with virtual machine environment when a virtual image is moved from one hypervisor to another.
I found this analysis called “Serial Number based on BFI HW Scan” from this link https://bigfix.me/analysis/details/2998606.
It has the following relevance script called “Serial Number based on BFI HW Scan” and it does what I want. But the problem is that it reports back all the Serial Number values from each *.xml file when the value is different. It works very well if the Serial Number value is the same from all *.xml files.
I have been playing around the “modification time of it” function with the relevance script below and no luck getting it to work.
I need this relevance script below to ONLY extract the Serial Number value from the latest copy of tlm_hw-*.xml file based on the date and time. This will report back the latest current Serial Number value and that all I care for. I know it can be done and I need some experts to help me out here. Thanks.
if (name of operating system as lowercase starts with “win”) then (if (exists folder ((if (version of client >= “9” as version) then (pathname of parent folder of data folder of client) else (pathname of parent folder of regapp “besclient.exe”)) & “\LMT\CIT\tlm_hw_scans”)) then (unique values of (it as text) of (xpaths “Hardware/ComponentID/SerialNumber” of xml documents of files whose (name of it as lowercase contains “tlm_hw_”) of folders ((if (version of client >= “9” as version) then (pathname of parent folder of data folder of client) else (pathname of parent folder of regapp “besclient.exe”)) & “\LMT\CIT\tlm_hw_scans”))) else “Missing Hardware Scan”) else (if (exists folder (((if (version of client >= “9” as version) then (pathname of parent folder of data folder of client) else (pathname of parent folder of parent folder of client folder of site “actionsite”))) & “/LMT/CIT/tlm_hw_scans”)) then (if exists property “xml document” then (unique values of (it as text) of (xpaths “Hardware/ComponentID/SerialNumber” of xml documents of files whose (name of it as lowercase contains “tlm_hw_”) of folders (((if (version of client >= “9” as version) then (pathname of parent folder of data folder of client) else (pathname of parent folder of parent folder of client folder of site “actionsite”))) & “/LMT/CIT/tlm_hw_scans/”))) else “Missing Hardware Scan” ) else “No information”)