I am trying to script removing our old MDM enrollment through DEP from Macs so I can have them prompt for DEP enrollment into Jamf. I am OK with the end user being prompted for their admin password but would rather not have them manually type in the commands into the terminal.
!/bin/bash
sudo rm -rf /var/db/ConfigurationProfiles/
sudo rm /Library/Keychains/apsd.keychain
sudo /usr/libexec/mdmclient dep nag
The commands work great when manually typed into terminal.
Unfortunately none of them seem to work in a script.
: command not found2:
Password:
rm: /Library/Keychains/apsd.keychain
: No such file or directory
[ERROR] Unknown command: nag
: command not found12: