MacOS update

jranchuk
New Contributor

does anyone have a script for updated macos. I have it being cashed on the user than deployed. I want a script that can prompt to install or delay. it currently only installs with out prompting.

7 REPLIES 7

jcarr
Release Candidate Programs Tester

Are you looking to update macOS or upgrade macOS?

If you're just updating, you can use the build in Software Update policy payload. It can be triggered either periodically, or when a user selects it via Self Service.

Upgrading would be a little more complex, as you need to make sure that the installer is in /Applications/ and then call startosinstall.

jranchuk
New Contributor

upgrade the OS, I have the installer going to the /applications folder. when I use the install policy from Chashe on system it just reboots and installs. would like a warning or prompt to delay or let them closer there apps that are open

JustDeWon
Contributor III

@jranchuk ... take a look at this

jranchuk
New Contributor

I have the script set and the Mojove in the applications folder. but the script does not run correct get an error "unapproved caller"

JustDeWon
Contributor III

@jranchuk , you set all the parameters in the policy, based off the script variables? The last time I've seen an Unapproved Caller error, was due to the computer itself. May have to boot into safe mode, then restart boot as normal.

anayat_chowdhur
New Contributor II

I have a very basic script that allows option to delay or update now with a gui but it's not perfect, have been meaning to get round to improving this but was in a pinch and this was quick and easy to implement. we run this on machines on outdated OS' once a day to prompt the user to update.

Hope this helps

#!/bin/bash


osvers=$(sw_vers -productVersion)


dialog="Your MacOS version is $osvers, and needs to be updated the latest version which is 10.14.5."
dialog2="Youe Mac is now updating. Please do not shutdown or restart. Your Mac will automatically reboot, the process may take upto an hour. Please save any unsaved work and close open applications"
description=`echo "$dialog"`
description2=`echo "$dialog2"`


jamfHelper="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"


title="Message from Wellcom IT"
icon="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Sync.icns"
icon2="/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Clock.icns"
heading="Updates Required"
heading2="Please wait..."
button1="Update"
button2="Cancel"

RESULT=$("$jamfHelper" -windowType utility -title "$title" -description "$description" -icon "$icon" -iconSize 240 -heading "$heading" -button1 $button1 -button2 $button2 -showDelayOptions "0, 300, 3600, 86400" -timeout)

if [ $RESULT == 1 ]; then
    "$jamfHelper" -windowType utility -title "$title" -description "$description2" -icon "$icon2" -iconSize 240 -heading "$heading"
    "/Applications/Install macOS Mojave.app/Contents/Resources/startosinstall" --agreetolicense --nointeraction
elif [ $RESULT == 3001 ]; then
    sleep 300
    "$jamfHelper" -windowType utility -title "$title" -description "$description2" -icon "$icon2" -iconSize 240 -heading "$heading"
    "/Applications/Install macOS Mojave.app/Contents/Resources/startosinstall" --agreetolicense --nointeraction
elif [ $RESULT == 36001 ]; then
    sleep 3600
    "$jamfHelper" -windowType utility -title "$title" -description "$description2" -icon "$icon2" -iconSize 240 -heading "$heading"
    "/Applications/Install macOS Mojave.app/Contents/Resources/startosinstall" --agreetolicense --nointeraction
elif [ $RESULT == 864001 ]; then
    sleep 86400
    "$jamfHelper" -windowType utility -title "$title" -description "$description2" -icon "$icon2" -iconSize 240 -heading "$heading"
    "/Applications/Install macOS Mojave.app/Contents/Resources/startosinstall" --agreetolicense --nointeraction
elif [ $RESULT == 2 ]; then
    echo "Cancel"
else "failed"
fi

jranchuk
New Contributor

@anayat.chowdhury

thank you for the script, it work but will not until reboot it just keep the popup window "updates Required"

the auto reboot not working the MacBook OS is High Sierra.