Narrowing the results of Application Information(Windows)

(imported topic written by trickey91)

I’m attempting to narrow the results of the following query (stolen from Application Information) to display only applications containing the name “Rational”:

(if (exists value “DisplayName” of it AND (length of (value “DisplayName” of it as string) > 0) AND (number of substrings " " of (value “DisplayName” of it as string) < (length of (value “DisplayName” of it as string)))) then (value “DisplayName” of it as string & (if (exists value “DisplayVersion” of it) then (" - " & value “DisplayVersion” of it as string) else (""))) else (name of it & (if (exists value “DisplayVersion” of it) then (" - " & value “DisplayVersion” of it as string) else ("")))) of keys whose (exists value “UninstallString” of it) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry

I’ve tried adding AND (value “DisplayName” of it as string contains “Rational”) in SEVERAL different spots with no success.

Any help would be greatly appreciated.

Thanks

Ron

(imported comment written by sthull)

Hi Ron,

I think the problem you were running into was with the high-level if-else stmt, where you use DisplayName value if it exists, otherwise you use the key name. If you qualify the DisplayName piece, the else will just cause all the other values to display the key name instead of DisplayName as opposed to leaving them out completely, which is what you want. Give this a try:

(if (exists value “DisplayName” of it AND (value “Displayname” of it as string contains “Rational”) AND (length of (value “DisplayName” of it as string) > 0) AND (number of substrings " " of (value “DisplayName” of it as string) < (length of (value “DisplayName” of it as string)))) then (value “DisplayName” of it as string & (if (exists value “DisplayVersion” of it) then (" - " & value “DisplayVersion” of it as string) else (""))) else (if (name of it as string contains “Rational”) then (name of it & (if (exists value “DisplayVersion” of it) then (" - " & value “DisplayVersion” of it as string) else (""))) else ("") )) of keys whose (exists value “UninstallString” of it) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry

Regards,

Steve

(imported comment written by BenKus)

Hey Ron,

Steve’s way will work, but it will spit out a blank value for each uninstall entry. You can try to limit the results by checking the displayname when iterating through the registry keys:

(if (exists value “DisplayName” of it AND (length of (value “DisplayName” of it as string) > 0) AND (number of substrings " " of (value “DisplayName” of it as string) < (length of (value “DisplayName” of it as string)))) then (value “DisplayName” of it as string & (if (exists value “DisplayVersion” of it) then (" - " & value “DisplayVersion” of it as string) else (""))) else (name of it & (if (exists value “DisplayVersion” of it) then (" - " & value “DisplayVersion” of it as string) else ("")))) of keys whose (exists value “UninstallString” of it +AND exists value “DisplayName” of it AND value “DisplayName” of it as string as lowercase contains “rational”+) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry

I put my changes in italics. It is only in one place.

But…

If you want to search for applications in your deployment, this might be easier:

http://forum.bigfix.com/viewtopic.php?id=884

Ben

(imported comment written by trickey91)

I have an even better question. How the heck do I get as smart in this as you folks. Seriously. Are there books, classes, etc. that you took to gain advanced knowledge in the BigFix action language?

(imported comment written by BenKus)

Hey trickey,

Yes. BigFix offers full relevance training classes (1 day, 2 days, or 3 days) that can teach you all sorts of things. Check out http://www.bigfix.com/support/services/training.html or http://support.bigfix.com/fixlet/

Ben