Skip to main content
Question

Erase and Install script


Forum|alt.badge.img+1

I can't seem to get the script to work. I'm very new to Jamf and scripting. I want to erase and install my school lab.

I'm on High Sierra and I have the installer in my applications folder. This is the script I am using. I set up a policy to run it to lab scope. I dragged the startosinstall file into a Terminal window.

'/Applications/Install macOS High Sierra.app/Contents/Resources/startosinstall' ‑‑eraseinstall
--agreetolicense

I receive error message -

Executing Policy Erase and Install 3

Running script erase and install 3...

Script exit code: 127

Script result: /Library/Application Support/JAMF/tmp/erase and install 3: line 1: /Applications/Install macOS High Sierra.app/Contents/Resources/startosinstall: No such file or directory
/Library/Application Support/JAMF/tmp/erase and install 3: line 2: --agreetolicense: command not found

Error running script: return code was 127.

3 replies

CSCC-JS
Forum|alt.badge.img+8
  • Valued Contributor
  • 125 replies
  • April 29, 2020

The entire command has to be in one line.


Forum|alt.badge.img+9
  • Contributor
  • 154 replies
  • April 29, 2020

Hi @rjwick There is no need to have quotes when you use backslashes.
I.e

 '/Applications/Install macOS High Sierra.app/Contents/Resources/startosinstall' ‑‑eraseinstall --agreetolicense ‑‑newvolumename 'Macintosh HD'

Is equivalent to:

/Applications/Install macOS High Sierra.app/Contents/Resources/startosinstall ‑‑eraseinstall --agreetolicense ‑‑newvolumename 'Macintosh HD'

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3540 replies
  • April 30, 2020

@rjwick In addition to the proper quoting that @shaquir points out, be aware that startosinstall requires a logged in user to run if you're planning on pushing the command to your lab using a Jamf Pro Policy triggered by something other than Self Service

I'm also going to put in a plug here for the macOSUpgrade script written by @Rosko, a Jamf engineer, as it's a much more comprehensive update script than just calling startosinstall. If nothing else it'll give you some ideas on scripting.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings