I've been using a policy executing a straight up restart option bound to a SCG that gathers every Macbook that hasn't been turned off for more then 10 days but I find the policy to be too invasive since it doesn't allow deferral as far as I know.
I've been searching if there is a way to just send a notification if somebody enters a SCG on their Macbook but I can't find anything of the sort and I'm not very good at scripting either.
Do you have any tips about it?
Thank you
How do I alert people if their Macbook turned on for more then x days?
Best answer by Anusan16
Then you can use the Jamf Helper. It will prompt a message on screen. Use this script on a policy then scope the SCG. Ensure you test to get the desired outcome.
#!/bin/bash
# Path to Jamf Helper
JAMF_HELPER="/Library/Application Support/JAMF/bin/jamfHelper.app/Contents/MacOS/jamfHelper"
# Message and options
HEADING="System Restart Required"
MESSAGE="To complete essential updates, please restart your device. You can choose to restart now or delay until later."
# Display the Jamf Helper window with two buttons
USER_CHOICE=$("$JAMF_HELPER" -windowType utility -title "$HEADING" -heading "$HEADING" -description "$MESSAGE" \\
-icon "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertNoteIcon.icns" \\
-button1 "Restart Now" -button2 "Later" -defaultButton 1)
# Check the user's choice
if [ "$USER_CHOICE" == "0" ]; then
# Restart the device immediately
sudo shutdown -r now
else
# Postpone the restart and notify again in 1 hour (optional customization)
echo "User chose to restart later."
fi
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.




