I do a policy that will run script for user to shutdown/restart their laptop if the uptime is more than 7days.
The script is like this:
set question to display dialog "The machine has not been shut down or restarted for more than a week. Please shut down or restart the machine by clicking on Shut Down or Restart." with title "System Event by Andres Cheah, MCM" with icon stop buttons {"Shut Down", "Restart", "Cancel"}
set answer to button returned of question
if answer is equal to "Shut Down" then
tell application "System Events"
shut down
end tell
end if
if answer is equal to "Restart" then
tell application "System Events"
restart
end tell
end if
if answer is equal to "Cancel" then
return
end if
I test in the machine it is working fine, but when i put into the policy; there an error below:
Script exit code: 1
Script result: 2013-09-23 10:15:47.576 osascript[2866:707] ApplePersistence=NO /Library/Application Support/JAMF/tmp/System event-AppleScript Applet.scpt: execution error: No user interaction allowed. (-1713)
Anyone can advise?