Hello, I am trying to add relevance to an “Applications Installed” property I created to report on all applications installed to exclude all hotfixes or patches. A sample is below that works, but the main problem is that it reports on all patches and hotfixes, which we would like to exclude from list. How can I exclude patches from this?
if (name of operating system as string contains “SunOS”) then (unique values of params “PKGINST” of pkginfos of pkgdb) else if (name of operating system as string contains “AIX”) then (unique values of names of products of object repository) else if (name of operating system as string contains “Linux”) then (unique values of names of packages of rpm) else if (exists wmi) then ((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
This should work, I modified it in the past, and from reports it works correctly.
(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 ( “” )) whose (it as string does not contain “Hotfix” )) else (name of it & (if (exists value “DisplayVersion” of it) then ( " - " & value “DisplayVersion” of it as string) else ( “” )) as string)) whose (it as string does not contain “Hotfix” and it as string does not contain “Security Update for Windows” and it as string does not contain “Update for Windows”) of keys whose (exists value “UninstallString” of it) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry
Doug
Edit: I just realized you had added in the relevance for the other O/S’s which I did not do in this statement.
Using Doug’s example above and creating a simple text file locally on your machines with a name of each required application (1 name per line), you could get a list of required applications that are not installed by querying:
lines whose (not exists (it ,((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 ( “” )) whose (it as string does not contain “Hotfix” )) else (name of it & (if (exists value “DisplayVersion” of it) then ( " - " & value “DisplayVersion” of it as string) else ( “” )) as string)) whose (it as string does not contain “Hotfix” and it as string does not contain “Security Update for Windows” and it as string does not contain “Update for Windows”) of keys whose (exists value “UninstallString” of it) of key “HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of registry)) whose (item 0 of it as string as lowercase is contained by item 1 of it as string as lowercase))of file “c:\requiredlist.txt”
Here I am assuming that the pathname to the file with a list of required applications is “c:\requiredlist.txt”