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