Return 'yes or no' for Computer Model names

(imported topic written by SystemAdmin)

I am using the following value to return the computer name of my windows devices.

string values of selects “Model from Win32_ComputerSystem” of wmi

I need to write the statement in a way so that if it is a certain model, then it will return and answer such as ‘In Scope’, something like the following…

if (string values of selects “Model from Win32_ComputerSystem” of wmi contains “4291”) elseif if (string values of selects “Model from Win32_ComputerSystem” of wmi contains “3421”) then “In scope”

I will compound this to input my models that are in scope, however I am struggeling to get this to work with the string value of the WMI call. Any ideas?

(imported comment written by Lee Wei)

Here is an example:

( 

if (it contains 
"4291" or it contains 
"3421" or it contains 
"4389") then (
"In Scope") 

else (
"Not Found") ) of string value of selects 
"Model from Win32_ComputerSystem" of wmi

Lee Wei

(imported comment written by SystemAdmin)

Always obvious when someone else types it. :slight_smile:

Thanks Lee!

(Selects “Model from win32_Computersystem” of wmi) contains “OptiPlex 9010”

I just need to to return true or false

If computer model = “Optiplex 9010” and Domain = “Domainname” return true

this is for an automatic computer group

Q: (it = "VMWare Virtual Platform") of string value of selects "Model from Win32_ComputerSystem" of wmi
A: True

Works on my windows VMWare vm.

And on same computer

Q: (it = "OptiPlex 9010") of string value of selects "Model from Win32_ComputerSystem" of wmi
A: False

If you need to do something based on the true/false use an if/then/else

if  (it = "OptiPlex 9010") of string value of selects "Model from Win32_ComputerSystem" of wmi then "I'm an Optiplex 9010" else "I'm not an Optiplex 9010"
1 Like

I would recommend using the SMBIOS inspector instead of WMI.

The advantage of SMBIOS is that it works on Windows & Linux/Unix, and is much more efficient than WMI typically is. See this analysis for examples: http://bigfix.me/analysis/details/2994751

I would always recommend starting with analysis properties that return the text you are looking to create relevance for, then adapt that into true/false relevance, and use an analysis property to check if it works the way you expect across all systems. This will help you know that it works the way you expect.

exists (it) whose(it as lowercase = "optiplex 9010") of (unique values whose(it != "") of (it as string as trimmed string) of values "product_name" of structures "system_information" of smbios)

When you say Domain, do you mean active directory, or the computer name, or the fully qualified domain name of the computer?

Just like if you have more then 1 domain, I want to get a get a list of all 9010’s in Domain1

I still have no idea what you mean by domain. Can you give some fake examples? Do you mean active directory domain of each endpoint?

You should be able to get this information using session relevance.

I got this one I used the first part of what you gave me, and the 2nd part for the domain I used bigfix built in stuff

(version of client >= “6.0.0.0”) AND ((exists true whose (if true then (exists (it) whose(it as lowercase = “optiplex 3020”) of (unique values whose(it != “”) of (it as string as trimmed string) of values “product_name” of structures “system_information” of smbios)) else false)) AND (exists true whose (if true then (exists (if exists value of settings “_BESClient_ActiveDirectoryPathOverride” of client then value of setting “_BESClient_ActiveDirectoryPathOverride” of client else if exists true whose (if true then exists distinguished name of local computer of active directory else false) then distinguished name of local computer of active directory else “”) whose (it as string as lowercase contains “smmc” as lowercase)) else false)))

So you do mean Active Directory Domain. Thanks for the clarification.

This session relevance will give you the count for all models across all domains for all results in which there are at least 5 of each model in each domain:

http://bigfix.me/relevance/details/3000115

You can use this in the Presentation Debugger in the console, or in Web Reports, or in the “Session Relevance Tester” or through the REST API.


By adding the following clause I can filter the results to just OptiPlex 9010’s:

whose(it contains "OptiPlex 9010")

Here are my actual results, when filtering for 20 or more of each, which is pretty interesting: (domain redacted)

There are 178 of Model:OptiPlex 9010’s in DomainA
There are 182 of Model:OptiPlex 9010’s in DomainB
There are 26 of Model:OptiPlex 9010 AIO’s in DomainC
There are 36 of Model:OptiPlex 9010’s in DomainC

Thank you so much for your help

1 Like