Posted on 08-22-2022 03:12 PM
Hi, does anybody have a simple script to notify users to check for updates and then takes them to the default software update in sys pref? I don't want to use nudge or other software and I don't want to force the update at this point. Basically just a nagging reminder at a set interval.
Thanks
Posted on 08-22-2022 03:37 PM
First idea that comes to mind is to "open" the system pref pane via script. That should just take the user directly to the sofware update interface.
open /System/Library/PreferencePanes/SoftwareUpdate.prefPane
Might need to script a Jamf Helper message or similar if you want more user explanation.
Posted on 08-22-2022 11:21 PM
Here is a script I just wrote that should do what you're asking for
#!/bin/sh
#quick and dirty jamfhelper script to prompt users to run macOS updates
JAMFHELPER="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"
# Get the user's selection
RESULT=`"$JAMFHELPER" -windowType utility -title "You Have Pending Updates" -description "You have a number of updates that are still pending for your Mac please update now" -button1 "Show me" -button2 "Cancel"`
if [ $RESULT == 0 ]; then
# do button1 stuff
open /System/Library/PreferencePanes/SoftwareUpdate.prefPane
echo "Show me was Pressed"
elif [ $RESULT == 2 ]; then
# do button2 stuff
echo "Cancel was pressed!"
fi
But I still think that you should look into Nudge. You don't need to get complicated with it the only properties you need to use are requiredInstallationDate and requiredMinimumOSVersion
Posted on 08-23-2022 07:41 AM
Thanks this will work great. However, I am not able to get it to run. Am I missing something?
Posted on 08-23-2022 07:57 AM
Are you trying to run it locally or through Jamf?
If you are trying to run it locally to test it, you will need to use chmod to give it the correct permissions.
as a script run by Jamf, it runs as root so it doesn't need any extra permissions
Posted on 08-23-2022 08:07 AM
both. I tried locally and the message pops up but when I press show me, I get this;
-bash: syntax error near unexpected token `fi'. When added to Jamf and scoped to a machine at check in, I can see the policy runs but no pop up. Even with chmod permissions it does not work locally.
Posted on 08-23-2022 08:41 AM
I have only tested it from self-service, and it's working from there.
But a quick search turned up this Jamf nation post about Jamf helper scripts failing when set to check-in - https://community.jamf.com/t5/jamf-pro/jamfhelper-from-check-in-hanging-script/m-p/116074
Posted on 05-22-2023 10:49 PM
Try this out
#!/bin/sh
currUser=$(ls -l /dev/console | awk '{print $3}')
currUserUID=$(id -u "$currUser")
JAMFHELPER="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"
# Get the user's selection
RESULT=`"$JAMFHELPER" -windowType utility -title "You Have Pending Updates" -description "Your Mac Machine is running with vulnerable version of macOS need to be updated immediately " -button1 "Update Now" -button2 "Cancel"`
if [ $RESULT == 0 ]; then
# do button1 stuff
/bin/launchctl asuser "$currUserUID" sudo -iu "$currUser" open /System/Library/PreferencePanes/SoftwareUpdate.prefPane
echo "Update Now was Pressed"
elif [ $RESULT == 2 ]; then
# do button2 stuff
echo "Cancel was pressed!"
fi
Posted on 05-24-2023 06:43 AM
Thanks, is there a way to adjust the script to add an icon?
Posted on 08-23-2022 04:43 AM
We use Nudge - it works well and has an "Agressive" mode to pester people to update to the version we want them on:
https://github.com/macadmins/nudge
Takes a bit of configuring but once you have it installed and running it really does the job.
08-23-2022 04:53 AM - edited 08-23-2022 04:53 AM
You can put @patelsanjay suggestion in a File & Processes payload. Create a Smart Group of computers with software available updates greater than zero. If any computers have any available updates, run the policy weekly or daily or whatever.