Where a vendor (in this case Microsoft) decides to shift gears between CFBundleVersion
and CFBundleShortVersionString
...and your management tool can't shift gears to keep up, or decides for you whether to use CFBundleVersion
or CFBundleShortVersionString
. ¯_(ツ)_/¯
We manage our own EAs so we don't end up with this nightmare...
The other problem with determining version, is the overhead incurred when using Like
or Not Like
in your Smart Computer Groups.
If you take the extra minute or three to create 2 or 3 EAs, instead of the usual 1, you'll thank yourself later...many many times.
Because JSS will be much better behaved, having less calculation to deal with...the less calculation, the faster JSS becomes.
Version (Major.Minor.Patch):
#!/bin/bash
if
-d /Applications/Microsoft Word.app ]; then
echo "<result>$( /usr/bin/defaults read /Applications/Microsoft Word.app/Contents/Info.plist CFBundleShortVersionString )</result>"
else
echo "<result>NotInstalled</result>"
fi
Major.Minor Version (Major.Minor):
#!/bin/bash
if
-d /Applications/Microsoft Word.app ]; then
echo "<result>$( /usr/bin/defaults read /Applications/Microsoft Word.app/Contents/Info.plist CFBundleShortVersionString | cut -f1-2 -d"." )</result>"
else
echo "<result>NotInstalled</result>"
fi
Major Version (Major):
#!/bin/bash
if
-d /Applications/Microsoft Word.app ]; then
echo "<result>$( /usr/bin/defaults read /Applications/Microsoft Word.app/Contents/Info.plist CFBundleShortVersionString | cut -f1 -d"." )</result>"
else
echo "<result>NotInstalled</result>"
fi
The above three EAs give you plenty of flexibility, and reduces your need for JSS calculation overhead.
$ /usr/bin/defaults read /Applications/Microsoft Word.app/Contents/Info.plist CFBundleShortVersionString
15.19.1
$ /usr/bin/defaults read /Applications/Microsoft Word.app/Contents/Info.plist CFBundleShortVersionString | cut -f1-2 -d"."
15.19
$ /usr/bin/defaults read /Applications/Microsoft Word.app/Contents/Info.plist CFBundleShortVersionString | cut -f1 -d"."
15
Microsoft Word 2016 version Like
"15.19." <-- requires JSS to perform a calculation.
but
Microsoft Word 2016 (Major.Minor) version Is
"15.19" <-- does not require any calculation.
Now if we can just get the team responsible for Patch Reporting and/or Patch Management to stop using Spotlight for EAs...maybe @michael.scafide will pass the word along for us. ;)
Maybe we can get @amanda.wulff to provide one of her excellent analysis/overview summaries, of the pitfalls of using Like
and Not Like
...since there doesn't seem to be a lot of documentation on its effect on JSS performance.
More info on Semantic Versioning standard: http://semver.org/
EDIT: fixed the keys in the first paragraph, the commands were correct, thanks @mm2270]!
HTH,
Don