Checks if the application (Docker Desktop example) is installed and up to date, or not installed. Fails if the application is installed and on a lower version. You can copy this query and replace the bundle_identifier and bundle_version values to apply the same type of policy to other applications.
Create or edit a configuration profile with the following information:
Create or edit the following script and configure it to run when the check fails:
Use the policy below to verify:
SELECT 1 WHERE EXISTS (SELECT 1 FROM apps a1 WHERE a1.bundle_identifier = 'com.electron.dockerdesktop' AND a1.bundle_short_version>='4.6.1') OR NOT EXISTS (SELECT 1 FROM apps a2 WHERE a2.bundle_identifier = 'com.electron.dockerdesktop');
app=$(mdfind "kMDItemCFBundleIdentifier == 'com.electron.dockerdesktop'" | head -n1); [ -z "$app" ] && echo 1 || { ver=$(defaults read "$app/Contents/Info" CFBundleShortVersionString 2>/dev/null); [ "$(printf '%s\n' 4.6.1 "$ver" | sort -V | head -n1)" = "4.6.1" ] && echo 1 || echo 0; }
PowerShell commands are currently work in progress, contributions welcome.
Bash commands are currently work in progress, contributions welcome.