Extension Attributes to get the Model Identifier and Model ID Version number

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 07-24-2012 09:19 AM
The following scripts work on Lion to grab the Model Identifier and also to strip out all but the Model Identifier Version number. To assist in the creation of smart groups, I'd recommend making the Model ID version number an integer. These have been tested under Mac OS X Lion only.
Good Luck and happy reconnoitering.
Model Identifier:
#!/bin/sh
echo "<result>$(system_profiler SPHardwareDataType | grep "Model Identifier" | awk '{print $3}')</result>"
Model Identifier Version number:
#!/bin/sh
echo "<result>$(system_profiler SPHardwareDataType | grep "Model Identifier" | tr -d [A-Z][a-z]:' ' | awk -F , '{print $1}')</result>"

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 07-24-2012 09:39 AM
You can also get the Model Identifier using ioreg, which is a bit faster than invoking System Profiler, like so-
ioreg -c IOPlatformExpertDevice | awk -F"= " '/model/{ print $2}' | sed -e 's/<"//;s/">//'

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 07-24-2012 03:02 PM
and just another tip anytime you find yourself doing
grep foo | awk
or
grep foo | sed
Do this instead
awk '/foo/{ print $3 }'
:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 01-29-2019 05:24 PM
