How to read integer value from a file located in different Subfolder

I am trying to search a value from .cfg file. The problem is that on each machine the file is located in different location. so here is what I have and what I am looking for.

File location is C:\ProgramData\Druva\inSync4\users…\insync.cfg (… ) is the user on that machine

I am searching : SERVERS = [’’

Basically I am looking if the file name inSync.cfg inside the C:\Programdata… has SERVERS = ['govcloud.druva.com:443'] than make those machines as relevant.

Here is the relevancy I am trying

search files whose (name of it as lowercase contains "inSync.cfg" AND exists line whose (it as lowercase contains "SERVERS = ['govcloud.druva.com:443']") of it) of folders of folders of folder "C:\ProgramData\Druva\inSync4\users\"

Help!!!

Try each of these in the debugger and let us know how it works…

Listing the files:
q: files "insync.cfg" of folders of folders "C:\ProgramData\Druva\inSync4\users"

Find files containing the string

q: files "insync.cfg" whose (content of it contains "govcloud.druva.com:443") of folders of folders "C:\ProgramData\Druva\inSync4\users"

See if any exist:
q: exists files "insync.cfg" whose (content of it contains "govcloud.druva.com:443") of folders of folders "C:\ProgramData\Druva\inSync4\users"

2 Likes

file is located inside C:\ProgramData\Druva\inSync4\users\nick or depending on the username such as mark, james. I have created the fixlet using these irrelevancies and will see once the machines start reporting… thank you for such a quick response.

So an example full path would be?

C:\ProgramData\Druva\inSync4\users\JGStew\insync.cfg

If so, then @JasonWalker 's relevance should be correct.

1 Like

This relevancy works great.

I have another question and lets say I want to reverse this relevancy that It check the file does not have that entry ? Also how can I exclude a user security group , Lets say group name is “test-users” ?

That depends on a few things. Do you want it to be relevant if NO insync.cfg file exists with that entry, or do you want it to be relevant if ANY insync.cfg file exists without that entry?

I want it relevant if there is no entry of govcloud.druva.com:443 in the insync.cfg file.

You didn’t really answer my question. There are 2 different ways to go about this.

This will be true if the file doesn’t exist at all, or if all of the insync.cfg files do not have govcloud.druva.com:443 within them:

not exists files "insync.cfg" whose (content of it contains "govcloud.druva.com:443") of folders of folders "C:\ProgramData\Druva\inSync4\users"

This may not be what you want though, it sounds like what you are aiming for is if any insync.cfg without that entry, which would be different relevance.

The challenging part here is really when there are multiple insync.cfg files for multiple users on the same system. If a particular system only ever has at most one insync.cfg file, then this is much more straightforward.

in our environment we almost always have only one user profile. multiple profiles are only on our test or pilot machines which are not that many

1 Like

In that case, this should be sufficient and most efficient:

not exists files "insync.cfg" whose (content of it contains "govcloud.druva.com:443") of folders of folders "C:\ProgramData\Druva\inSync4\users"
1 Like

That works like a charm and I have verified using both relevance.

1 Like

Do you mean in AD? or a bigfix automatic group? or a bigfix manual group?

This is probably best answered in a separate question.

Yes it is an AD group used for Druva.

Examples:

Related: