Posted on 12-20-2016 10:28 AM
Hello, I'm looking for some assistance with filling in the Active Directory computer object descriptions for our macOS devices.
We're trying to do it via the ldapmodify command as per the script below and it works when we run it through Self Service but not when it runs at any sort of checkin.
The script below is an example and is pretty basic but let me know what I could try if you have any ideas.
#!/bin/bash
CurrentUser=`/usr/bin/w | grep console | awk '{print $1}'`
#CurrentUser=`stat -f "%Su" /dev/console`
echo $CurrentUser
HostDesc="$(hostname)"
su "$CurrentUser" -c "id -F" > /tmp/CurrentName.txt
NameDesc="$(cat /tmp/CurrentName.txt)"
echo dn: CN=$HostDesc,OU=MAC,OU=Computers,OU=HOF,OU=Sites,DC=prd,DC=mpac,DC=ca > /tmp/entrymods
echo changetype: modify >> /tmp/entrymods
echo replace: description >> /tmp/entrymods
echo description:$NameDesc >> /tmp/entrymods
su "$CurrentUser" -c "ldapmodify -f /tmp/entrymods -h prd.mpac.ca"
Posted on 12-28-2016 09:01 AM
Solved. We used the dscl command instead.