Adding to many OR causes boolean error

(imported topic written by Fcruson)

I am trying to look for servers that start with XXX in the Computer Name and am receiving
**boolean error. **

This is the relevance I am starting with and looks like there is a limit for the code.

( (name of it as lowercase contains “Win” as lowercase ) of operating system) AND (exists keys “HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName” whose (exists values whose(name of it = “ComputerName” AND it as string as lowercase starts with “CTX” as lowercase ) of it) of registry) OR (exists keys “HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName” whose (exists values whose(name of it = “ComputerName” AND it as string as lowercase starts with “WCX” as lowercase ) of it) of registry)

I was just adding this to the end of the code and changing the starts with “XXX” to what was needed. After doing this 13 times in the same relevance code I received an error. How can I search for servers with “XXX” or “YYY” or etc?

Any ideas on coding this better?

(imported comment written by MattPeterson)

So the simplest way would be to add you other conditions within the first “whose” statement, instead of writing out the entire statement multiple times. see below:

(windows

of

operating system)

AND

(
exists

keys

“HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName”

whose

(
exists

values

whose

(name

of

it

=

“ComputerName”

AND

it

as

string

as

lowercase

starts with

“abc”

or

it

as

string

as

lowercase

starts with

“xyz”
)

of

it
)

of

registry)

You could make this statement shorter and easier to expand by using a regex instead of writing out "it as string as lowercase starts with “acb” 16 times. Also be careful, when you enter your values in there to be sure they’re in lowercase, since your casing the value into lowercase. See the regex example below:

(windows

of

operating system)

AND

(
exists

keys

“HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName”

whose

(
exists

values

whose

(name

of

it

=

“ComputerName”

AND

it

as

string

as

lowercase

=

(regex

“abc.|xyz.
))

of

it
)

of

registry)

(imported comment written by Fcruson)

Thank you so much, after doing some research on how to use this code it worked great!!!

Thanks again,

Frank Cruson

(imported comment written by jgstew)

I would break it up into multiple relevance statements:

Relevance 1:

(windows of operating system)

Relevance 2:

exists values “ComputerName” of keys “HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName” of (registry;native registry)

Relevance 3:

exists (it as string as lowercase) whose(it starts with “abc” OR it starts with “xyz”) of values “ComputerName” of keys “HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName” of (registry;native registry)

But even better would be to use the (computer name) inspector:

Relevance 1:

(windows of operating system)

Relevance 2:

exists (it as lowercase) whose(it starts with “abc” OR it starts with “xyz” OR it starts with “blah”) of computer name

(imported comment written by Fcruson)

thank you, now I have several ways to retrieve the same results. I will give the computer name inspector a try also.

(imported comment written by Fcruson)

Shucks, now i need to exclude a set of servers that start with EP2 from a group built on EP. My second Relevance statement is not removing the servers that start with EP2. Any ideas? Would it be better to put both in one statement?

Relevance 1

(windows of operating system) AND (exists keys “HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ActiveComputerName” whose (exists values whose (name of it = “ComputerName” AND it as string as Uppercase = (regex “EP.*”)) of it) of registry)

Relevance 2

((name of it as Uppercase does not contain “EP2”) of operating system)

(imported comment written by jgstew)

The issue seems to be that you are looking at “operating system” when you mean to check “computer name”

Relevance 1:

(windows of operating system)

Relevance 2:

( exists computer name whose(it as uppercase starts with “EP” AND it as uppercase does not start with “EP2”) )

(imported comment written by Fcruson)

Worked!

Looks like I was putting to much thought into it.

Thanks!

Frank Cruson