Skip to content

Commit

Permalink
Added update_enduser_jamf.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
golbiga committed Dec 9, 2013
1 parent e112020 commit f21cb3f
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions update_enduser_jamf/update_enduser_jamf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/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

# 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-`

if [[ "$currentuser" = root ]];
then
echo "No one is logged in, exiting."
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
fi
exit 0

0 comments on commit f21cb3f

Please sign in to comment.