08-11-2021 01:39 PM - edited 08-11-2021 01:40 PM
Hello,
When re-enrolling our devices via DEP, the computer name from the Jamf inventory is reverting to the default (e.g. MacBook Air), and the assigned user and information is completely lost/wiped, and it all needs to be reentered. The only field that seems to stick in Jamf on re-enrollment is the Asset Tag.
I have made sure that the clear user info checkboxes are not ticked in the Re-Enrollment settings:
Is there a reliable way to retain the computer information entered into JAMF when performing a re-enrollment so it doesn't have to be reentered each time?
Thanks!
08-13-2021 07:08 AM - edited 08-13-2021 07:08 AM
Not sure why this is happening, but you can add my script below in combination with DEPNotify or however you're provisioning to repopulate the user info.
# jamfProUserInfo.sh
# Brandon Woods
# June 2021
# This script locates the current user and updates Jamf Pro with user details
jamfBinary="/usr/local/bin/jamf"
currentUser=`python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");'`
fullName=`dscl . -read /Users/$currentUser RealName | tail -1`
emailAddress="$currentUser@dnb.com"
# Update username in Jamf Pro
echo $currentUser
echo $fullName
echo $emailAddress
# Set username in Jamf Pro
sudo $jamfBinary recon -endUsername "$currentUser"
# Set full name in Jamf Pro
sudo $jamfBinary recon -realname "$fullName"
# Set email address in Jamf Pro
sudo $jamfBinary recon -email "$emailAddress"
# Exit Script
exit 0 ## Success
exit 1 ## Failure