Feature req

winkelhe
New Contributor

I would like to see the model identifier (keep model name as well) in the JSS. anyone else?

![external image link](attachments/3c57963254c34beba8f3074305596f40)
![external image link](attachments/aa059015e54d40deb259fc39cd530e82)

12 REPLIES 12

friedelj
New Contributor III

I'm new to Casper. Would you be willing to share what you're entering for the Extension Attribute? I would guess it includes sysctl hw.model, but I'm not quite sure how to format the script to display that value correctly.

Thanks.

Joe Friedel, iCIT

University of Wisconsin - Whitewater

Andersen Library, Room 2003F

(262) 472-1658

winkelhe
New Contributor

heres what i did....

#!/bin/bash

echo "<result>`system_profiler | grep 'Model Identifier:' | awk '{print $3}'`<result>"

RobertHammen
Valued Contributor II

Do you mean have both "MacBook Pro (15-inch, Early 2011)" AND MacBookPro8,2? On May 19, 2011, at 12:37 PM, Eric Winkelhake wrote:

If so, I agree...

winkelhe
New Contributor

precisely.

![external image link](attachments/5f082da9161d4ef5847f5e22b00f3046)

donmontalvo
Esteemed Contributor III

We created an Extension Attribute to show the Model Identifier.

Don

--
https://donmontalvo.com

winkelhe
New Contributor

good call...i just set that up. didn't even occur to me to do that, thanks.

![external image link](attachments/7a6dcad35152458b9fa350acc3937151)
![external image link](attachments/b95ed3c102ce468c91eb595eb69ad49c)

donmontalvo
Esteemed Contributor III

I got a few off list requests to post the Extension Attribute...here it is...I stole the idea from an April post (thanks to Sean Gallagher!). I tweaked it a bit....

------------- begin -------------

#!/bin/sh
#
# Stolen from a Sean Gallagher script! :)

Devices=system_profiler SPHardwareDataType | grep -e "Model Identifier" | awk '{print $3}'

echo "<result>$Devices</result>"

-------------- end --------------

--
https://donmontalvo.com

rockpapergoat
Contributor III

slightly shorter:

system_profiler SPHardwareDataType | awk '/Model Identifier/ {print $NF}'

donmontalvo
Esteemed Contributor III

Hi Nate,

This is awesome! Ya know, it's like the old school uphill bike racers used to say when discussing low gear ratios...the smaller the better! :)

Pardon me while I copy/paste into JSS...

Don

--
https://donmontalvo.com

rockpapergoat
Contributor III

easier still, install the latest version of facter and get the same fact like so:

facter sp_machine_model

my result: MacBookPro7,1

os x pkgs are here: https://sites.google.com/a/explanatorygap.net/puppet/

puppet depends on facter to generate "facts" about nodes, but you can use it as a standalone utility, too.

so you could simplify the extension attribute like this:

#!/bin/bash
echo "<result>$(/usr/bin/facter sp_machine_model)</result>"

run facter with no arguments to see all the stats it generates.

nice.

justinrummel
Contributor III

Going for shorter... :)
On Thu, May 19, 2011 at 7:34 PM, Nate St. Germain <nate at techsuperpowers.com>wrote:

sysctl hw.model | awk '{print $2}'

- Justin

donmontalvo
Esteemed Contributor III

Nice!!! Tested fine...i'll update JSS mañana. :)
Justin Rummel wrote:

Don

--
https://donmontalvo.com