Posted on 01-24-2020 01:51 AM
We have recently started to upgrade our 50+ Mac's to Catalina. We have the process sorted and the Mac's update, but when I look under patch Management for MacOS, they still say the machine is running 10.14.6 but when you go into a specific Machine and look at it's OS it says it is running 10.15.2
How can we get Patch Management to update to show the accurate versions?
Posted on 01-24-2020 07:51 AM
You need to update the inventory after the OS changes. A simple bit of code like the one shown, ran at startup would work...
# Get the OS on the Mac
OS_Version=$( sw_vers -productVersion )
# Check if the OS matches our logged one, do a recon if it doesn't.
if [ -f /Library/MacSD/os_version ]; then
Recorded_Version=$( cat /Library/MacSD/os_version )
if ! [ ${Recorded_Version} == ${OS_Version} ]; then
/usr/local/bin/jamf recon
echo ${OS_Version} > /Library/MacSD/os_version
else
echo "This Mac has rebooted but no OS change found. No recon necessary."
fi
else
echo ${OS_Version} > /Library/MacSD/os_version
fi
Posted on 01-27-2020 04:24 AM
Thanks for this. I just tried this on a test machine, but got the following error?
Script result: /Library/Application Support/JAMF/tmp/Run Inventory after macOS Upgrade: line 14: /Library/MacSD/os_version: No such file or directory
Do you know what I am doing wrong?
Posted on 01-27-2020 06:01 AM
Hi Marcchapman
MacSD is a directory we create to store all of the little scripts and icons we use. So the folder won't exist in your environment. Adding a "mkdir /Library/MacSD" to the script or changing the path for the os_version file would resolve the error.