I need to create some really bullet-proof, cross-platform relevance to collect some basic hardware information: manufacturer, model, and serial number.
I am 95% of the way there, but running into issues with two small minorities of Macs. Specifically, these seem to be 1. older macOS versions that are running the latest BigFix 9.5 client, and 2. a small subset of current macOS versions running the latest BigFix 10 client.
Here is just the Mac-specific part of the relevance I’m trying to use:
if exists smbios then ((unique values whose(it != "") of ((it as string as trimmed string) of values "vendor" of structures "bios_information" of smbios))) else "Apple Inc."
For subset (1) (older macOS, 9.5 client), this yields an “undefined” error:
The operator "smbios" is not defined.
Testing for the existence of smbios doesn’t appear to help. I have tried using a | to trap the error, but that also doesn’t appear to help. Does anyone have ideas on how to get around this error message?
For subset (2) (current macOS, latest 10 client), this yields an “error” error:
dmi inspector error creating dmi.info ([[CreateDmiInfoFromIOService: Unable to get the SMBIOS service.][CreateDmiInfoDevMem cannot open /dev/mem (2)][CreateDmiInfoMMap cannot open /dev/mem (2)]])
Again, I have attempted to use | to catch this error with no success. I am wondering if this might indicate a system where the BigFix Client doesn’t have the Full Disk Access permission or some similar permissions issue?
I also have a small subset of Windows systems that are throwing an error. Here is the Windows snippet of relevance I’m using:
string value of select "Manufacturer from Win32_ComputerSystem" of wmi
Around 1% of my Windows systems throw this “error” error:
The expression could not be evaluated: Windows Error 0x8007000e: Not enough memory resources are available to complete this operation.
My guess is that this is a transient error that may go away once the systems have restarted. But it would still be really handy to be able to reliably return a string like “N/A” instead of the error message for my use case.
For the interested, here are the full, cross-platform relevance strings I’m using for my analysis properties:
Serial Number - Universal
if windows of operating system then (string values of selects "IdentifyingNumber from Win32_ComputerSystemProduct" of wmi) else if mac of operating system then (string "IOPlatformSerialNumber" of dictionary of service plane of iokit registry) else if ((it contains "linux" OR it contains "hp-ux" OR it contains "sunos" OR it contains "aix") of (name of operating system as lowercase)) then (unique values whose(it != "") of (it as string as trimmed string) of values "serial_number" of structures "system_information" of smbios) else "N/A"
Serial Number 2 - Universal (this is a simplification of the previous that is almost as reliable but yields the errors above)
if (exists hardware) then (serial of hardware) else if (exists smbios) then (values "serial_number" of structures "system_information" of smbios as string) else "N/A"
Manufacturer - Universal
if windows of operating system then (string value of select "Manufacturer from Win32_ComputerSystem" of wmi) else if mac of operating system then (if exists smbios then (unique values whose(it != "") of ((it as string as trimmed string) of values "vendor" of structures "bios_information" of smbios)) else "Apple Inc.") else if ((it contains "linux" OR it contains "hp-ux" OR it contains "sunos" OR it contains "aix") of (name of operating system as lowercase)) then (unique values whose(it != "") of (it as string as trimmed string) of values "vendor" of structures "bios_information" of smbios) else ("N/A")
Model - Universal
if windows of operating system then (string values of selects "Model from Win32_ComputerSystem" of wmi as trimmed string) else if mac of operating system then (machine name as string) else if ((it contains "linux" OR it contains "hp-ux" OR it contains "sunos" OR it contains "aix") of (name of operating system as lowercase)) then (unique values whose(it != "") of (it as string as trimmed string) of values "product_name" of structures "system_information" of smbios) else "N/A"
Unique Identifier - Universal (this is ultimately what I’m trying to combine all of the previous properties into)
if windows of operating system then (concatenation "-" of ((string value of select "Manufacturer from Win32_ComputerSystem" of wmi);(string values of selects "Model from Win32_ComputerSystem" of wmi as trimmed string);(string values of selects "IdentifyingNumber from Win32_ComputerSystemProduct" of wmi))) else if mac of operating system then (concatenation "-" of ((if exists smbios then (unique values whose(it != "") of ((it as string as trimmed string) of values "vendor" of structures "bios_information" of smbios)) else "Apple Inc.");(machine name as string);(string "IOPlatformSerialNumber" of dictionary of service plane of iokit registry))) else if ((it contains "linux" OR it contains "hp-ux" OR it contains "sunos" OR it contains "aix") of (name of operating system as lowercase)) then (concatenation "-" of ((unique values whose(it != "") of (it as string as trimmed string) of values "vendor" of structures "bios_information" of smbios);(unique values whose(it != "") of (it as string as trimmed string) of values "product_name" of structures "system_information" of smbios);(unique values whose(it != "") of (it as string as trimmed string) of values "serial_number" of structures "system_information" of smbios))) else ("N/A")
Any suggestions on making these as reliable as possible would be very welcome!
The use case is for a Service Now integration where we really needs these properties to be very reliably populated. We are trying to use the combination of these “immutable” properties of systems to uniquely id systems in Service Now, even across a system rebuild (which is why we’re not relying on the BigFix ID).
Thanks,
Jeremy.