Home > Casper, Mac administration, Scripting > Auto-populating the Location info in the Casper JSS inventory

Auto-populating the Location info in the Casper JSS inventory

In the past year, my worksite began using Jamf Software‘s Casper Suite system management tool to manage our Macs. One of the great things about it is that it automatically pulls a ton of information about the managed machines. However, it wasn’t set up to automatically show me who was using a particular machine. There’s a Location category, where you can manually query your Active Directory or LDAP directory service and set who’s associated with which machine. However, the fact that the process was manual almost guaranteed it would be out-of-date within a fairly short period of time. As a workaround, I set up an Extension Attribute that showed me who was the last reported user, but I wasn’t really happy with it. I had also set up the Building attribute to automatically update by setting the Building value to correspond to particular IP subnets.

There the situation stayed for a few months. I wasn’t particularly happy, but not unhappy enough to go through and update manually. Fortunately, a thread appeared on the Casper mailing list about this particular topic. After taking a look at the various scripts that were posted in response, I was able to adapt my own from the one that Ben Toms shared. It’s using dscl to query the AD plug-in on my Macs to get information on the currently logged-in user.

From there, I uploaded the script to my JSS and set up a policy to run it once a day.

Screen shot 2011-12-05 at 5.13.26 PM

Screen shot 2011-12-05 at 5.13.49 PM

Final result? I was able to go from this:

Screen shot 2011-12-05 at 4.48.52 PM

To this (some information redacted):

Screen shot 2011-12-05_redacted

Muuuch better. For those who want the script, I have it posted here on my GitHub repo.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: