Bar Code 2 and Apple Enterprise Connect

Lhsachs
Contributor II

Does anyone know how we can fill Bar Code 2? I don't see it as a choice in the list for JAMF recon:
I only see the following: -assetTag, -endUsername, -realname , -email, -position, -building, -department, -phone, -room, -ldapServerID, -userID

I'd like to use Bar Code 2 to fill in a user's domain name from Apple Enterprise Connect, using the AEC connection completed script. This way we can have customers use local logins - and we could then track systems via the domain names.

We could then use a connection completed script something like this:

```

#!/bin/sh # Sample Enterprise Connect connection completed script ecUser=$1 ecDomain=$2 sudo jamf recon -skipApps -skipFonts -skipPlugins -barCode2 $ecUser logger -t “EC Connection Completed” “User $ecUser from domain $ecDomain has successfully connected” exit 0
4 REPLIES 4

mm2270
Legendary Contributor III

Might need to use the API. I don't see any other way of populating the Barcode strings in the record. Honestly, I never use them, but doesn't look possible from a normal recon type method.

Also, I'm not sure the -skipApps -skipFonts -skipPlugins flags actually do what you think they do. jamf help doesn't show those as valid flags anymore.

Josh_Smith
Contributor III

@Lhsachs I agree with @mm2270 (as usual!), those options aren't doing what you want, see here:
RECON: Bring back the verbs!

I'd create an Extension Attribute to store this information. I'm not sure exactly how you want to configure this, but it sounds like you want to store the info once and be done with it. You could have your setup script write the value to a plist and the EA could read the plist at every inventory, or your script could use the API to write it to an EA that isn't tied to a script.

Lhsachs
Contributor II

Josh,
The problem with an extension attribute is that it runs every time you do an Inventory Update. If we could place the data in a hidden area, you could pull it when the EA runs, which is why I'm looking to fill the BarCode2 field (which I'm not sure I can fill) from the script. I use a similar methodology with my script to fill the AssetTag field. (that script runs when a system is being imaged - hides the system name in /var/db (may need to move....) and then uses this the line below from my script to fill the assetTag field. "jamf recon -skipApps -skipFonts -skipPlugins -assetTag $vasset"
In the initial part of my assetTag script, I hide the asset name on the system..

Josh_Smith
Contributor III

@Lhsachs I think either of these solutions could work for you:

  1. A scripted extension attribute to hold your value: Have your script write the $ecUser value to a file that stays on the machine somewhere, then at every inventory the EA reads the value. As you noted this updates at each Inventory, but the idea is the file never changes so the value never changes. I've done this before to stamp a machine with a static image version in /Library/Application Support/OrgName and it works well. There isn't any performance hit to updating a simple EA at inventory, so there isn't a lot of downside, and it's very easy to implement.

  2. A text field (non scripted) EA that holds your value: This is essentially what you are trying to do with BarCode2, but with a text EA you are creating your own field which you can name whatever you want (ECUser). This will NOT update at every inventory. You can have a script write this value once using the API, no need for a jamf recon command. @mm2270 wrote up an example of how to modify a static, text field EA with the API here: https://jamfnation.jamfsoftware.com/discussion.html?id=9158#responseChild49833 This is a little more complicated since you have to understand the API syntax, but this way you can create a new field that does what you want instead of trying to commandeer an existing field and change it's purpose.