Re-enroll a Mac into the Device Enrollment Program (DEP) without erasing

Launch Terminal.app


Type the following commands:

sudo rm /var/db/.AppleSetupDone

sudo rm -rf /var/db/ConfigurationProfiles/

sudo rm /Library/Keychains/apsd.keychain


Restart the Mac and re-enroll via DEP