Scripted OS Install Prompt Using AppleScript

jamiesmithJAX
New Contributor III

Hi, I'm not much of a scripter, but I am trying to create a method for upgrading very old hardware to Mojave. Basically I want to show the user a prompt where if they click Upgrade Now, it will give them one last chance to back out, otherwise, it will trigger a custom event policy and begin the download/install of Mojave. My script works flawlessly in script editor, but when I run it as a policy, if fails with error "syntax error: unexpected end of file" and I can't figure out why (I'm sure it is something simple!"

Here is my script, any advice is appreciated:

display alert "Dear Colleague;

Our records show that you are the primary user of a Mac computer running an older, unsupported version and must be updated to a supported version by the end of September.

Depending on network speed, the upgrade may take up to an hour, during which time your computer will be unavailable for use.

You may be prompted to restart the computer after the upgrade completes

If you choose not to upgrade the operating system on this Mac before September 30, the allowable use of the computer is limited to managing a piece of lab equipment, but not connected to the JAX network. Since the computer is unable to run Office 365 applications, it may not be used for email or office productivity tasks.

Would You Like to Upgrade Your Operating System to macOS Mojave Now?" buttons {"Upgrade Now", "Remind Me Tommorrow"}

if button returned of result = "Upgrade Now" then display alert "Are you sure you wish to upgrade to macOS Mojave. The upgrade will take 1-2 hours to complete" buttons {"Proceed with Upgrade", "Remind Me Tommorrow"} if button returned of result = "Proceed with Upgrade" then do shell script "/usr/local/bin/jamf policy -event MojavePrompt" with administrator privileges
end if

1 REPLY 1

jamiesmithJAX
New Contributor III

answered my own question, #!/usr/bin/osascript