Hello,
I have a script that I run every login to change the computer name in JSS & locally :
#!/bin/sh
APIUSER=sdf
APIPASS=sdf
JSS=cs.esl-lan.net
#Get Last User
LASTUSER=/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'
#Get MAC Address
MACADDRESS=system_profiler SPNetworkDataType | grep "MAC Address:" | awk '{print $3}' | sed s/:/./g | head -1
#Change computer name in JSS to last user logged in
echo curl -k -u $APIUSER:$APIPASS http://$JSS:8443/JSSResource/computers/macaddress/$MACADDRESS -d "name=$LASTUSER" -X PUT
/usr/bin/curl -k -u $APIUSER:$APIPASS http://$JSS:8443/JSSResource/computers/macaddress/$MACADDRESS -d "name=$LASTUSER" -X PUT
#Change local computer name
echo /usr/sbin/jamf setComputerName -name $LASTUSER
/usr/sbin/jamf setComputerName -name $LASTUSER
So far it work, but I would like to update the username of the JSS computer entry, which is located in <computer><location><username/></location></computer>
I'm sure it's possible as it's in the python example, but I can't figure how to do it with curl. I get a 200. Here's the command :
curl -k -v -u sdf:sdf http://cs.esl-lan.net:9006/JSSResource/computers/macaddress/00.26.08.0e.a8.54/subset/location -d "username=esl-francois" -X PUT
To be honest, I'm not confident at all with REST, I've tried to read some documentation, but I don't really understand why it's failing.
Francois
--
Francois Tiffreau | IT operations Manager
ESL Education
Head office – Switzerland
Grand-Rue 50, 1820 Montreux
t +41 21 962 88 80 | f +41 21 962 88 81
skype esl.francois
Please consider the environment before printing this e-mail
This e-mail message may contain certain confidential and privileged material for the sole use of the intended recipient. Any review, use or distribution by others is prohibited. If you are not the intended recipient, please contact the sender and destroy or delete all copies.
