diff --git a/update_enduser_jamf/update_enduser_jamf.sh b/update_enduser_jamf/update_enduser_jamf.sh index 371042b..422ec44 100755 --- a/update_enduser_jamf/update_enduser_jamf.sh +++ b/update_enduser_jamf/update_enduser_jamf.sh @@ -1,22 +1,16 @@ #!/bin/bash -# This script checks who is logged into the machine and if they are an AD user -# If the user is in AD, a recon will run and update the endUsername +# This script checks who is logged into the machine and updates username in JSS. # Who is logged in and what type of account is it -currentuser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` -accounttype=`dscl . -read /Users/$currentuser | grep UniqueID | cut -c 11-` +loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'` -if [[ "$currentuser" = root ]]; - then - echo "No one is logged in, exiting." +if [ $loggedInUser = "root" ]; then + echo "No one is logged in" exit 1 else - if (( "$accounttype" < 1000 )); then - echo "This account is not in AD, exiting." - exit 1 - else - echo "This account is in AD, lets run jamf recon." - /usr/sbin/jamf recon -endUsername $currentuser - fi + echo "Running recon for $loggedInUser `date`..." + # Run recon, submitting the users username which as of 8.61+ can then perform an LDAP lookup + sudo jamf recon -endUsername $loggedInUser + echo "Finished running recon for $loggedInUser `date`..." fi -exit 0 +exit 0 \ No newline at end of file