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?
(
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
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"
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?
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)))
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:
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