Fixlets: Concatenation causes fixlet to fail

Hi everyone. I have what is a seemingly simple goal for my Fixlet. I need to retrieve the hardware serial number from a bunch of machines and then concatenate that value with the hostname. It should look like this: SomeSerial_SomeHostName. I then need to assign that value to a custom tag. Here’s what I have working so far:

setting “_SerialNum”="{unique values whose(it != “”) of (it as string as trimmed string) of values “serial_number” of structures “system_information” of smbios}" on “{now}” for client

I got that script for the serial number from here: https://bigfix.me/analysis/details/2994751

My problem is that whenever I try to concatenate that value with hostname, the fixlet fails. I’ve joined the two values several different ways using the QnA debugger and those all work, just not in the actual BigFix console. Here’s an example that “should” work:

setting “SerialNum"="(unique value whose(it != “”) of (it as string as trimmed string) of values “serial_number” of structures “system_information” of smbios)" & "” & hostname on “{now}” for client

But this will fail every time. Can anyone help me work this out? Thanks!

Have you tried

setting "SerialNum"="{unique value whose(it != "") of (it as string as trimmed string) of values "serialnumber" of structures "system_information" of smbios}_{hostname}" on "{now}" for client

Remember what is in betwen the {} is just a substitution. Additionally I’ll put my normal thing about never putting “now” as the time as it allows for out of order setting

I just tested that and unfortunately it failed. Any other suggestions?
Also, what should I be putting for the time instead of now?

Possible - serial value does not exist? could trap for that error…

q: (((unique value whose(it != “”) of (it as string as trimmed string) of values “serialnumber” of structures “system_information” of smbios)|“N/A”) & “_” & (hostname|“N/A”))
A: N/A_BrollyWin7

Also, to add to what AlanM said about using {now} and settings out of order, you can use parameter “action issue date” of action for safer results.

Try:
setting “SerialNum”="{(((unique value whose(it != “”) of (it as string as trimmed string) of values “serialnumber” of structures “system_information” of smbios)|“N/A”) & “_” & (hostname|“N/A”))}" on {parameter “action issue date” of action} for client

1 Like

I gave that a try and got another failure, but thank you for the input.

I know the serial number exists because I can run the fixlet without any concatenation and it works. Seems that any sort of concatenation causes the fixlet to fail. The strange part is that in the QnA debugger, my concatenations all work fine, just not in the actual console.

let’s try a fully guarded clause instead of the quick and easy pipe operator for our error trap:

setting “SerialNum”="{((if (exists true whose (exists (unique value whose(it != “”) of (it as string as trimmed string) of values “serialnumber” of structures “system_information” of smbios))) then ((unique value whose(it != “”) of (it as string as trimmed string) of values “serialnumber” of structures “system_information” of smbios)) else (“N/A”)) & “_” & (if (exists true whose (exists hostname as string)) then (hostname as string) else (“N/A”)))}" on “{parameter “action issue date” of action}” for client

Just tested in my BigFix 9.5.5 VM:

q: setting “SerialNum” of client
A: SerialNum=N/A_BrollyTest

We had a similar issue after the 9.5 upgrade which introduced Unicode. It changed the way SMBIOS (among other things) are presented. Unfortunately some of these are not well known or documented.

In my relevance that used SMBIOS, I had to cast as hexadecimal instead of string for it to work. The ‘as string’ casting is likely the issue.

The example in my world: (value “uuid” of structure “system_information” of smbios) as hexadecimal