I’m using the below query to get all installed software but I could not get into right syntax to filter out some of the results. An example, i want to filter out “redistribute” or “hotfix”
(values "DisplayName" of it) of keys whose (exists value "DisplayName" of it AND exists value "UninstallString" of it) of key "HKLM\SOFTWARE\Microsoft\Windows\ CurrentVersion\Uninstall" of registry
You can filter results in relevance using the ‘whose (condition of it)’ method. For your example, try something like:
(values “DisplayName” whose (it as string as lowercase does not contain “hotfix” AND it as string as lowercase does not contain “redistribute”) of it) of keys whose (exists value “DisplayName” of it AND exists value “UninstallString” of it) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry
It works. Thanks Aram for quick reply. I have one more question. I have plenty of excludes. Is there a way to reduce code here by specifying a list of excludes instead of repeating it as string as lowercase every tiem for every filter.
it as string as lowercase does not contain("redis", "hotfix")
For such cases, you might consider leveraging relevance expressions to facilitate more complex (or larger) filtering conditions. Here’s one potential example:
values “DisplayName” of keys whose (exists value “DisplayName” of it AND exists value “UninstallString” of it AND (not exists matches (regex “hotfix*|redis*”) of (value “DisplayName” of it as string as lowercase))) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry