-
Notifications
You must be signed in to change notification settings - Fork 14
/
superrecon.sh
executable file
·25 lines (22 loc) · 1.24 KB
/
superrecon.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/bin/bash
#
# superrecon2.sh
#
# scrape directory for user & location info
userloggedin="$(who | grep console | awk '{print $1}')"
adcheck=$(dscl . read /Users/${userloggedin} AuthenticationAuthority | grep LocalCachedUser)
if [ -z "${adcheck}" ]
then
echo "superRecon - ${userloggedin} is a Local Account"
echo "------------------------------------------------------------------------"
jamf recon -endUsername "${userloggedin}" -position "Local Account" -realname "" -email "" -position "" -phone "" # blank out empty fields in jss.
else
echo "supeRecon - ${userloggedin} is an AD Account"
echo "------------------------------------------------------------------------"
userrealname=$(dscl . -read /Users/${userloggedin} original_realname 2> /dev/null | tail -1 | cut -d ' ' -f 2-)
useremail=$(dscl . -read /Users/${userloggedin} EMailAddress 2> /dev/null | cut -d ' ' -f 2-)
userposition=$(dscl . -read /Users/${userloggedin} JobTitle 2> /dev/null | tail -1 | cut -d ' ' -f 2-) # these keys may not be filed
userphone=$(dscl . -read /Users/${userloggedin} PhoneNumber 2> /dev/null | tail -1 | cut -c 2-)
jamf recon -endUsername "${userloggedin}" -realname "${userrealname}" -email "${useremail}" -position "${userposition}" -phone "${userphone}"
fi
exit 0