Extension Attribute for Mac Model with Year.

munirajuh
New Contributor II

Hello, 

We are finding some error on current Extension Attribute  Mac model with Year on M1 Chip devices. Let me know any suggestions. 

9 REPLIES 9

Bol
Valued Contributor

Something like this maybe;

echo "<result>`/usr/sbin/sysctl hw.model | awk '{print $2}'`</result>"
<result>MacBookAir10,1</result>

 

Bol
Valued Contributor

Sorry I just realised you wanted the marketing model, you can craft something from this;

/usr/bin/defaults read ~/Library/Preferences/com.apple.SystemProfiler.plist 'CPU Names' | cut -sd '"' -f 4 | uniq
MacBook Air (M1, 2020)

 

munirajuh
New Contributor II

Above lines are going more details. I will try on that. 

junjishimazaki
Valued Contributor

Jamf inventory collection for each mac already displays the year/model of the Mac including the M1. If you go to the Hardware section of a Mac record it will display the make/model/year and the basic specs. 

Couple of M! Chip devices giving error like " ?xml version="1.0" encoding="utf-8" ?><root><error>0009</error><locale>en_US</locale></root>".  

Which models?  I have 74 Apple Silicon Macs and don't have any XML errors.  I am showing these models correctly:

MacBook Pro (13-inch, M1, 2020)
MacBook Pro (14-inch, 2021)
MacBook Pro (16-inch, 2021)

Bol
Valued Contributor

@munirajuh Have you seen this extension attribute script, might be helpful as a reference or for testing. Came up in the recommendations

https://community.jamf.com/t5/jamf-pro/collect-year-from-mac-marketing-model-name/m-p/250495 


junjishimazaki
Valued Contributor

You can run a policy to run recon on those macs to see if it reports back correctly

lwerbeloff
New Contributor II

I'm trying to break down the result of "MacBook Pro (13-inch, M1, 2020)" to just "2020"
Has anyone had any luck / can give suggestions?