Checking a WMI string against multiple values

(imported topic written by Matt.Johnson)

I’m sure there’s is a way to do this (I assume the “OR” variable):

I can poll the current computer model and compare it against a singular expression - Such as:

Q:(concatenation of (string values of selects “Model from Win32_ComputerSystem” of wmi) as lowercase contains “Latitude E6410” as lowercase)

A:True

However, I want to have it compare against multiple models. So I think I need to use the “OR” command, but for the life of me I cannot get it to work.

Can someone please reply with an example of how to do this?

Thanks!

(imported comment written by Lee Wei)

Here is an example:

q: (it as lowercase contains “lenovo w510” or it as lowercase contains “latitude e6410”) of string values of selects “Model from Win32_ComputerSystem” of wmi

Lee Wei

(imported comment written by Matt.Johnson)

Hi Lee,

Thanks for the quick response.

However, I am trying to do multiple results. As in:

The string equals “latitude e6410” OR “latitude 740” OR “latitude 242”

Can you provide that?

Thanks.

(imported comment written by Matt.Johnson)

Never mind Lee. For some reason I misread your statement. Thank you!

(imported comment written by Matt.Johnson)

For some reason the code doesn’t work:

I have a E6410 and it comes out TRUE when I ask just for the string’s return, but when I use the code you provided it equates to FALSE even if it’s in the list. Here is the code I am using:

(concatenation of (string values of selects “Model from Win32_ComputerSystem” of wmi) as lowercase contains “Latitude D430” or it as lowercase contains “Latitude D630” or it as lowercase contains “Latitude E4200” or it as lowercase contains “Latitude E4300” or it as lowercase contains “Latitude E4310” or it as lowercase contains “Latitude E6220” or it as lowercase contains “Latitude E6230” or it as lowercase contains “Latitude E6320” or it as lowercase contains “Latitude E6330” or it as lowercase contains “Latitude E6400” or it as lowercase contains “Latitude E6410” or it as lowercase contains “Latitude E6420”) of string values of selects “Model from Win32_ComputerSystem” of wmi

(imported comment written by Matt.Johnson)

The code provided isn’t generating the desired result.

(imported comment written by Matt.Johnson)

It helps if I lowercase everything as your example clearly had shown.

(imported comment written by Lee Wei)

This doesn’t work?

q: (it as lowercase contains “latitude d430” or it as lowercase contains “latitude d630” or it as lowercase contains “latitude e4200” or it as lowercase contains “latitude e4300” or it as lowercase contains “latitude e4310” or it as lowercase contains “latitude e6220” or it as lowercase contains “latitude e6230” or it as lowercase contains “latitude e6320” or it as lowercase contains “latitude e6330” or it as lowercase contains “latitude e6400” or it as lowercase contains “latitude e6410” or it as lowercase contains “latitude e6420”) of string values of selects “Model from Win32_ComputerSystem” of wmi

(imported comment written by Matt.Johnson)

Lee,

It worked fine. I missed the fact it was “as lowercase” and some of my data had Caps. After making it all lowercase in the relevance it worked great.

Thanks for all your help, sorry for the misunderstanding.

(imported comment written by Lee Wei)

Cool, just happy it is working for you.