Create accounts when adding to DEP w/o LDAP or AD?

lizmowens
New Contributor III

We don't use LDAP. Is there a way for me to include info on the CSV file I'm uploading to add new Mac laptops in DEP/Apple School Manager so that both my admin account and a specific user account are created and tied to a specific serial number?

1 REPLY 1

FrozenWaltDisne
New Contributor III

You could do this be creating multiple PreStage enrollments. This would also allow you to tie the order number directly to the computer. To make the account, you could make a bash script to pull the user account from the API and create a user with that same user ID.

Here is an example of a API pull that I used, you can replace the tag with the appropriate field. That field you can find by going to "https://mycompany.jamfcloud.com/api"

Make sure you make an API account with read only access to the sections you want to be read.

This is a snippet from one that will automatically rename computers to fit a specific naming convention. Currently it's setup to read the JAMF ID number of the computer.

#!/bin/bash

MACADDRESS=$(networksetup -getmacaddress en0 | awk '{ print $3 }')
JSS=https://mycompany.jamfcloud.com:443
API_USER=apiaccount
API_PASS=password


## Get JAMF XML
XML=$(curl -k $JSS/JSSResource/computers/macaddress/$MACADDRESS --user $API_USER:$API_PASS )

##Find ID
#String to search
STRI="<id>"
#Find Position in string
IDPOS=${XML%%$STRI*}
IDPOSNUM=${#IDPOS}
#Find length of search variable
STRLNGT=${#STRI}
#Start after Tag
IDFPOS=`echo "$STRLNGT + $IDPOSNUM" | bc`
#Terminate string Length
IDFPOST=`echo "$STRLNGT + $IDPOSNUM + 10" | bc`
#Grab String and cut excess
ID=`echo ${XML:$IDFPOS:$IDFPOST} | cut -d "<" -f 1`

When you reformat the computer, just make sure you "flush" all the commands, and when you setup the account again it will grab the previous JAMF settings. Although with using the pre-stage you could probably delete the account and it will just redo the whole process regardless.

Hope that helps. The bash script is more of a start then a full solution.