Distinguishing MacBooks and iMacs/Macminia in SmartGroups with M2

Ismere
Contributor

Hi everyone,
the previous Administrator at my Workplace used the Model identifier with like "Book" and not like "Book" to sort the Macs into MacBooks and all the other more Stationary Macs.


After the first departments bought the new M2 MacBooks Pro, we noticed that Apple had removed the word Book from the Identifier, meaning that the MacBooks were suddenly treated like an iMac or Mac-Mini.


My solution for this would be to evaluate the value of Battery Capacity. For iMacs and Mac-minis it says N/A, while MacBooks always have a percentage there.

Out of curiosity, how do you implement this distinction, if at all?
Would anyone recommend another way?

1 ACCEPTED SOLUTION

sdagley
Esteemed Contributor II

@Ismere Can you post the portion of your script that's doing the model determination? We're not using the 13-inch M2 MacBook Pros, but the following code is still working for detecting the M2 MacBook Air:

model=$(ioreg -l | grep "product-name" | cut -d "=" -f 2 | sed -e s/[^[:alnum:]]//g | sed s/[0-9]//g)
isMacbook=$(echo "$model" | grep "Book")

 

View solution in original post

9 REPLIES 9

sdagley
Esteemed Contributor II

@Ismere Can you post the portion of your script that's doing the model determination? We're not using the 13-inch M2 MacBook Pros, but the following code is still working for detecting the M2 MacBook Air:

model=$(ioreg -l | grep "product-name" | cut -d "=" -f 2 | sed -e s/[^[:alnum:]]//g | sed s/[0-9]//g)
isMacbook=$(echo "$model" | grep "Book")

 

We do not use any script. We are using the Build-In information of Jamf in combination with a Smart Group to split the Computers in the Mobile and Non-Mobile Groups.

sdagley
Esteemed Contributor II

@Ismere Have you tried using Model as your Smart Group criteria instead of Model Identifier? That still includes "Book" for M2 MacBook Airs (I don't have an M2 MacBook Pro to test)

That sounds like a good idea. It is funny that you do not have an M2 MacBook Pro to test and i do not have an M2 MacBook Air to test xD. And the Idea sounds great.

But i checked the information written in our M2 Pros, sadly they look like this:

Screenshot 2022-08-23 at 08.41.46.png

 

If i have the chance and time ,i will try your Model script. Hopefully the Product-name still includes the word Book if not well as always we will find a way. But thank you so far for your feedback which included Interesting Information about the other M2 Model.

 

sdagley
Esteemed Contributor II

@Ismere What version of Jamf Pro are you running? If it's an older version (we're currently on 10.37.2) it could be that it doesn't have the "friendly" model descriptions.

@sdagleyWe are running 10.39.1 at the moment so we are even a bit newer then the one you are using at the moment.

sdagley
Esteemed Contributor II

@Ismere So much for that theory then :-) You might open a support case with Jamf asking why you're seeing the raw model identifiers instead of the names as that does not seem right.

@sdagley 


While testing we found out that "Battery Capacity is not N/A" is not usable in Jamf it always says "not a number" even tough the Interface itself is giving you the option to choose it 🤣. But the bigger Problem is that M1 iMacs that are running MacOS 12 have N/A in there Inventory but for the purpose of a Smart Group it will be used as 0...

In the meantime i had the Chance to test your script. Good News the M2 MacBook Pro Contains the word Book in its Product-name. This means Product name in ioreg is not equal to Model and Model Identifier in Jamf. But we will switch over to it. Looks like the best option for now.
Thanks for your input, it was helping a lot and we will work adept the script to identify Books.

schiemsk
New Contributor III

Hi,

We're also have a "laptop and the rest" logic in order to scope specific softwares (policies) and configuration profiles only on laptop.

Since (today, for us) a MacBook Pro (M2) has now "Mac14,7" as model id and since we're also used the "Book" term as criteria to feed the laptop smartgroup, I have simply construct a new extension attribute and put an "OR" in criteria.

The extension attribue script is :

 

#!/bin/sh
AltModelName=$(echo $(system_profiler SPHardwareDataType |grep 'Model Name') | awk '{print $3" "$4}')
echo "<result>$AltModelName</result>"

 

The output gives "MacBook Pro" as shown for "Model Name" in the hardware information pane of System Informations.

Criterias updated and all policies and configuration profiles play again (after a recon, obv.)

schiemsk_0-1664377437062.png

 

edit : one more info

I have to do that because no any usefull info could be retrieve with ioreg and with sysctl -n