Session Relevance to filter Unmanaged Asset Import Time

I would like to use the field “Import Time (Server Time)” from the unmanaged assets to create a list of machines that were imported less than x (7) days ago. The following code is getting me close, it shows the ID’s of the machines whose import date contains the string “20”…

ids of bes unmanagedassets whose (value of field whose (name of it = "Import Time (Server Time)") of it contains "20")

… so now I am seeking help to convert the ‘it contains “20”’ into something like ‘less than 7 days ago’. My attempts to cast the values to dates or even integers have all failed.

Anybody do this before or have some ideas?

Thanks.

Chris

Got a bit further with my coding. Was able to get the list of dates in the unmanaged assets to now display as dates, but still can’t get them to be the filter of the results.

 (
  preceding text of first "/" of following text of first "/" of it & " " & 
 (
  it as integer as month as three letters 
 )
  of preceding text of first "/" of it & " " & preceding text of first " " of following text of last "/" of it 
 )
of values of fields 
whose
(
    name of it = "Import Time (Server Time)" 
)
of bes unmanagedassets as date  

Now I just need to take this logic, flip it to the filter and compare it.

This should do it: https://bigfix.me/relevance/details/3002582

ids of bes unmanagedassets whose(exists (current date - it) whose(it < 7 * day) of (it as date) of ( ((it as integer as string) of preceding text of last "/" of following text of first "/" of it ) &" "& (preceding text of first "/" of it as integer as month as three letters)&" "& (following text of last "/" of it as integer as string)) of (preceding text of first " " of it) of values of fields whose("Import Time (Server Time)" = name of it) of it)

Related:

2 Likes

I owe you a big big drink somewhere, sometime.

1 Like

There should be an RFE filed for the bes unmanagedassets properties to have an option to return the raw date/time values that bigfix natively parses rather than only having this odd version that we have to manipulate to turn into a real date object type.