![]() I was also thinking that my EA script above could be made to look for a local file with the full model name, and do the curl pull from Apple if its not there, then write the value into the file. To correctly gather all those models into a Smart Group. I still think getting the full human readable name direct from Apple in an EA is the best approach, since then you can just do something like Actual model name | is | "MacBook Pro (15-inch, Late 2011)" I suppose its probably not likely, but I don't know for sure. SerialNum=$(ioreg -rd1 -c IOPlatformExpertDevice | awk -F'"' '/IOPlatformSerialNumber/')Įcho "NOT The only possible issue with that approach is that the Serial Number criteria does not have an "ends with" modifier, only "like" so there's a remote possibility of those last 3 characters showing up somewhere else within the serial number. There are variations on this general process out there as well, so pick your poison.Įdit: Here's a somewhat simplified version of the EA script that gets the same information, just doesn't need to do 2 possible curl commands to get it. See my post on this old FR for an example of how to do it. Your best bet is to implement an Extension Attribute that uses Apple's own process to identify the actual Mac name, and not go by some wacky translation table the way JAMF is doing. JAMF has a hardcoded table in the JSS database that translates the model ids into a human readable name, but since Apple is using the same id for multiple different models, well, you get the picture. Isn't a model identifier supposed to be unique to that specific hardware!? grrrr Apple!!)Īnyway, I've complained often about this myself before. (Aside: Who in their right, sane mind decided it was a good idea to re-use a model identifier. Its JAMF mostly, although in some cases, Apple is also to blame since they very stupidly started deciding to re-use model identifiers for different Macs. Hopefully that will help you get part of the way to your SG. I know this can be cleaned up a lot, and there might be a different way to do this, but I just wanted to prove it could be done with the code. Print "Usage: macmodelshelf.py serial_number" Print >sys.stderr, "Unknown model %s" % repr(sys.argv) ![]() Output = subprocess.check_output(['/usr/sbin/ioreg', ![]() Model = lookup_mac_model_code_from_apple(code)įor code, model in sorted(ems()): Print >sys.stderr, "Looking up %s from Apple" % code Return et.findtext("configCode").decode("utf-8") If len(serial) in (12, 13) and serial.startswith("S"): # Remove S prefix from scanned codes.ĭef lookup_mac_model_code_from_apple(model_code):į = urllib2.urlopen("" % model_code, timeout=2) If "serial" in serial.lower(): # Workaround for machines with dummy serial numbers. Print >sys.stderr, "Couldn't open macmodelshelf.db: %s" % e You'll need to place Per's macmodelshelf.db file somewhere on these machines and update the script to point to that location, but once done you have an EA that will return the model info. I took Per's code ( ), borrowed some code from ( ) and made a few changes to be able to use this as an EA. :-(ĭoes anyone have any suggestions for how I can create a smart group to differentiate between the two models of 2011 15" MacBook Pros? If it's pulling it from the machine, well damnit. If Casper is pulling the model name from a built-in database - STOP! Please. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |