Posted on 10-06-2015 02:27 AM
Hi guys ,
I would like to get all the computers which are assigned to the current login user ( via command ) .
Do you have any idea , if this is possible ?
Posted on 10-06-2015 02:42 AM
Hi, you use the jamf recon
command. Here's a guide from the Mac mule https://macmule.com/2014/05/04/submit-user-information-from-ad-into-the-jss-at-login-v2/
Posted on 10-06-2015 07:05 AM
Hi , if i am not wrong that command is used in order to update the JSS and not get information for specific user .
Posted on 10-06-2015 07:14 AM
You might need to clarify exactly what it is you're looking for. Personally I'm not sure I understand what you mean by computers assigned to user.
If you happen to be capturing the user information on your Macs in the User & Location fields, then you can search for a username in the JSS and pull up any Macs that have that name assigned to them. Is that what you mean?
Posted on 10-07-2015 12:48 AM
Yes , i want to do that via script and not manually .
Posted on 10-07-2015 05:50 AM
Here is the script we use to grab and set the user field in Casper, we also tied our AD information in to set additional fields casper offers as you see in the script.
Background on our AD, we have our's setup as firstinitial lastname so i.e jjones for me.
#!/bin/sh
loggedInUser=""
loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`
userRealName=`dscl . -read /Users/$loggedInUser | grep RealName: | cut -c11-`
userPosition=`dscl . -read /Users/$loggedInUser | grep JobTitle: | cut -c 11-`
userDepartment=`dscl . -read /Users/$loggedInUser | grep "Company:" | cut -c 10-`
sudo jamf recon -endUsername "$loggedInUser" -realname "$userRealName" -position "$userPosition" -department "$userDepartment"
Posted on 01-05-2016 11:13 AM
You all might want to vote this up to auto-set the JSS assigned user field based on usage:
https://jamfnation.jamfsoftware.com/featureRequest.html?id=4304
Posted on 01-05-2016 11:33 AM
Sounds like the command you're looking for is below (got from this discussion - https://jamfnation.jamfsoftware.com/discussion.html?id=17402):
FYI, the discussion where this comes from has an error in the syntax of the command: it lists -endUserName rather than -endUsername
jamf recon -endUsername $(defaults read /Library/Preferences/com.apple.loginwindow lastUserName)
This goes through recon and reports the last user as the user assigned to the computer. We ended up creating two separate inventory update policies, one for computers not assigned to any one individual (cart and lab computers) and one for computers assigned to individuals.