What It Does
The script is read-only. It looks up the applications whose name matches Name in the machine-wide installed-programs list, 64-bit and 32-bit, and compares each one's version with MinimumVersion. When FilePath is set it also reads that file's version, for example chrome.exe, and compares it the same way, which finds per-user and portable installs the list does not show.
Versions are compared number by number as up to four parts, so 1.10 is newer than 1.9. Text around a version is ignored, and a version with more than four parts is cut to four. An application whose version cannot be read at all counts as a problem, because it cannot be shown to be safe.
It alerts when at least one match is below MinimumVersion or unreadable. It is OK when every match is at or above it, or when nothing is installed, and the answer says which. A Name with fewer than three characters after dropping whitespace and wildcard characters is refused so one run cannot match everything.
In FilePath, environment variables such as %ProgramFiles% are expanded, but %LOCALAPPDATA%, %APPDATA% and %USERPROFILE% are SYSTEM's own profile when it runs from an RMM. To check every user's copy, write {USERPROFILES} in capitals, and the path is tried once for each folder under C:\Users.
Before You Run It
- Take MinimumVersion from the vendor's advisory. It is the first safe version.
- Schedule it in your RMM and alert on exit 1, so a new vulnerable install shows up.
- Use FilePath with {USERPROFILES} for apps that install in each user's profile.
- Remember nothing installed is OK. It alerts on a match whose version cannot be read.
Type and Risk
- Type: Monitor. It checks one condition. It exits 1 when it finds the problem, so your RMM can alert on it, 0 when all is well, and 2 when it could not run.
- Risk: Low. It reads and changes nothing.
- Restart: It never restarts the machine.
- Typical run: Under 10 seconds.
- Example answer: "7-Zip 23.01 is below the minimum 24.07 (1 of 1 checked)"
- Tested before listing on Windows 11 with Windows PowerShell 5.1, run as SYSTEM, against its own test cases.
Inputs
Pass an input as an argument (-Name value), as an environment variable with the same name, which is how most RMMs pass script variables, or change its default in the param() block at the top of the script. An argument wins over an environment variable, which wins over the default.
- Name: Application name as shown in Apps & features; * and ? work, and a name without a wildcard matches anywhere in the name. Set Name, FilePath or both. Default empty.
- MinimumVersion: The first safe version, such as 126.0.6478.55. Numbers separated by dots. Required.
- FilePath: A program file whose file version is also checked, for example C:\Program Files\Google\Chrome\Application\chrome.exe. Environment variables such as %ProgramFiles% are expanded; note that %LOCALAPPDATA%, %APPDATA% and %USERPROFILE% are SYSTEM's own profile when this runs from an RMM, not a user's. To check every user's copy write {USERPROFILES} (capitals), for example {USERPROFILES}\AppData\Local\Google\Chrome\Application\chrome.exe: the path is tried once for each folder under C:\Users. A file that does not exist counts as not installed. Default empty.
Every script also takes DryRun, OutputFormat (Text, Answer, Json or Csv), ExportPath and ResultField, which writes the answer to an RMM custom field.
License
Provided "as is" under the MIT License, without warranty of any kind. Test before production use. MSP Outpost and User First Digital Inc. accept no liability for any damage or loss.