Relevance - Folder Doesn't Exist

I have the following Relevance setup, however it’s not working:

not exists folder “C:\Program Files (x86)\ZixCorp\ZixSelect” OR not exists folder “C:\Program Files\ZixCorp\ZixSelect”

The goal here is if the ZixSelect folder is in Program Files (x86) or Program Files the machines do not show up as an applicable computer.

Thanks in advance.

If I understand your requirements correctly, you want a machine to report as FALSE if the ZixSelect folder exists in either Program Files folders.

If my assumption is correct, you’re using the wrong Operator; OR with two not statements will return true if either is true. You’re most likely wanting to use an AND operator in this case, because you want the statement to be FALSE if either or both folders exists.

This is one of the most common issues with boolean logic, wrapping your head around when AND or OR statements are appropriate.

Let me use the BigFix Enterprise folder as an example.

Check if folder does not exists in 32-bit program files using dynamic rather than hardcoded path

Q: not exists folders "BigFix Enterprise" of folders (values of variables "programfiles" of environment) A: False

Check if folder does not exists in 64-bit program files using dynamic rather than hardcoded path

Q: not exists folders "BigFix Enterprise" of folders (values of variables "programw6432" of environment) A: True

Check if folder does not exists in either program files folder, using OR operator

Q: not exists folders "BigFix Enterprise" of folders (values of variables "programfiles" of environment) OR not exists folders "BigFix Enterprise" of folders (values of variables "programw6432" of environment) A: True

Notice how you get a True result even though you’re looking for a False, because the OR operator takes precedence and returns TRUE because one statement is true.

Q: not exists folders "BigFix Enterprise" of folders (values of variables "programfiles" of environment) AND not exists folders "BigFix Enterprise" of folders (values of variables "programw6432" of environment) A: False

Here we get a false because the AND operator is skewed towards FALSE values, while OR leans towards TRUE.

You could also achieve this by changing the method you use to inspect:

not (exists folders "BigFix Enterprise" of folders (values of variables "programfiles" of environment) OR exists folders "BigFix Enterprise" of folders (values of variables "programw6432" of environment)) A: False

Here we are checking for the existence of X OR Y, instead of the non-existance. Then, we wrap that inspection into a NOT statement. Both of the latter statements achieve the same result, this is more of an exercise in figuring out how to work with boolean operators.

Hope that helps.

You should also make use of the builtin inspectors for program files x64 folder and program files x32 folder.

That can reduce it to
not exists folders "ZixCorp\ZixSelect"of (program files x32 folders; program files x64 folders)

3 Likes

Nice! I’ve been relying on those old environment variables for years, never knew there were options that easy!

Learn something every day, thanks!

There is also a native program files folder, and equivalents for \windows\system32 in the forms of native system folder, system x32 folder and system x64 folder

Along with registry there are also x32 registry, x64 registry, and native registry

For sure, native system folders/system x32/x64 folders are very useful as long as you remember when to use which :slight_smile: