Trying to pull information for one of specific folder on windows machine but due to non-standard installation target folder’s fixed path is not available hence cant search that path right away.
Able to get the path or existence of folder but its taking 25 to 60 sec which is very high. so if you can help me to some tuneup here.
Q: find folder "Intel" of (descendant folders of (folders (names of (drives whose (type of it is "DRIVE_FIXED")))))
A: C:\Program Files\Intel
Q: if exists (find folder "Vijay" of (descendant folders of (folders (names of (drives whose (type of it is "DRIVE_FIXED")))))) then True else False
A: False
T: 25277.838 ms
So this is not recommended as it probably won’t finish on a real agent. Look at how long this took on FixletDebugger and then multiply that by 20x for how a 2% agent would be performing.
Using descendant folders is not recommended at all.
On a regular deployment you will probably get the error Inspector Interrupted a lot due to the systems desire to prevent runaway relevance
What is the program in question? The best way to find the install path is to look it up in the Uninstall Key of the product to figure out where it was installed, then use that.
Is the folder generally located in a few specific places? if so, then you could check for those places instead of looking everywhere, which is not a good idea.
If you want to check a few specific paths, then you would want to do it like this:
folders "Intel" of (folders whose(name of it starts with "Program Files") of it; it) of root folders of drives whose (type of it is "DRIVE_FIXED")
This is not the most efficient method, but much much better than using descendants in an open ended way.
The even better method would be to do something like this:
(folders it) of (it as string as trimmed string) of values "InstallLocation" of keys whose(value "DisplayName" of it as string as lowercase contains "microsoft visual studio code") of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x64 registries; x32 registries)
You won’t always find “InstallLocation” in the registry, but you should be able to find the info you are looking for SOMEWHERE in the registry, even if it is in a different value in the Uninstall key, or if it is in the program specific location.
As an example, this is how I would get the install path of Google Update without using the Uninstall Key:
parent folders of (files it) of (it as string as trimmed string) of values "path" of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Google\Update" of (x64 registries; x32 registries)
Depending which modules you are using, BigFix Inventory may help here with it’s package and file information. If you know what you are lookign for then relevance will naturally give you a real-time answer, and will be efficient.
If you aren’t sure, have to take a wide birth, or you are searching for a specific thing that could be anywhere on the file system then BF Inventory would be the best approach. The obvious downsides is that it’s based on scan data which can be ‘x’ hours or days old but depending on your use case, that might be acceptable.
If you need that ‘real-time-ness’ then you take your findings in BFI and translate that back to your relevance to be more specific/targeted.
I like this idea, using the info in Inventory to find what you need in general, then using that to help write relevance to do the same, or find edge cases you might have missed.