Sample Header Ad - 728x90

AppleScript: How to do shell script with admin privileges that only asks for password on first run/never?

0 votes
0 answers
609 views
I'm trying to write an AppleScript that will update the schedule boot/wake time of computer to be a hour from the time the script is run. My script below works, but every time I run it, I'm asked for admin password. Since I plan to schedule this to run hourly, how do I get this to run silently in the background? Reason: Working remotely, I need remote Macs that get accidentally turned off, to automatically start no later than one hour after it's been turned off. on run tell (current date) to set curHour to (its hours as string) tell (current date) to set curMin to (its minutes as string) if curHour + 1 > 23 then set newHour to "00" else set newHour to curHour + 1 end if set newTime to newHour & ":" & curMin & ":" & "00" as string do shell script "pmset repeat wakeorpoweron MTWRFSU " & newTime with administrator privileges end run
Asked by DasKraut (31 rep)
Aug 12, 2022, 10:08 PM
Last activity: Aug 13, 2022, 01:08 AM