assign users to computers via API

RogerH
Contributor II

Has anyone been able to assign users to a computer via API I am having trouble navigating the API docs. I want to use cocoadialog to prompt our techs to enter a userID and then assign the mac to that user.

6 REPLIES 6

bumbletech
Contributor III

What I do is have a policy that's scoped to all computers, but limited to our technicians' LDAP group. When the user is logged into the computer, the technician logs into self service and runs a policy with this script:

#!/bin/sh

# get the last user that logged into the computer
lastUser=`defaults read /Library/Preferences/com.apple.loginwindow lastUserName`

# echo the last user's username so it's in the policy log for error checking
echo "$lastUser is last user"

# submit inventory for the last user's username in the JSS
jamf recon -endUsername "$lastUser"

RogerH
Contributor II

Thanks @jbourdon but since our JSS talks to our service desk system I need this to happen during initial setup

mm2270
Legendary Contributor III

@RogerUL Can you be more specific on what it is you want with this? Where are you looking to assign the user to the computer? In the User and Location details?

RogerH
Contributor II

@mm2270 yes exactly

brandonusher
Contributor II

Have you tried using the check box of "Collect user and location information from LDAP" from here? https://jss.vcpusd.k12.ca.us:8443/inventoryCollection.html?id=0&o=r

M0J077
New Contributor II

Was any progress ever made with this? automating the process with the API?