Skip to main content
Question

Feature req

  • May 19, 2011
  • 12 replies
  • 18 views

Forum|alt.badge.img+5

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

Forum|alt.badge.img+6
  • Contributor
  • 17 replies
  • May 19, 2011

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


Forum|alt.badge.img+5
  • Author
  • Contributor
  • 89 replies
  • May 19, 2011

heres what i did....

#!/bin/bash

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


RobertHammen
Forum|alt.badge.img+28
  • Esteemed Contributor
  • 1027 replies
  • May 19, 2011

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...


Forum|alt.badge.img+5
  • Author
  • Contributor
  • 89 replies
  • May 19, 2011

precisely.

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


donmontalvo
Forum|alt.badge.img+36
  • Hall of Fame
  • 4293 replies
  • May 19, 2011

We created an Extension Attribute to show the Model Identifier.

Don


Forum|alt.badge.img+5
  • Author
  • Contributor
  • 89 replies
  • May 19, 2011

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
Forum|alt.badge.img+36
  • Hall of Fame
  • 4293 replies
  • May 19, 2011

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 --------------


Forum|alt.badge.img+13
  • Contributor
  • 427 replies
  • May 19, 2011

slightly shorter:

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


donmontalvo
Forum|alt.badge.img+36
  • Hall of Fame
  • 4293 replies
  • May 20, 2011

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


Forum|alt.badge.img+13
  • Contributor
  • 427 replies
  • May 20, 2011

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.


Forum|alt.badge.img+13
  • Contributor
  • 159 replies
  • May 20, 2011

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
Forum|alt.badge.img+36
  • Hall of Fame
  • 4293 replies
  • May 20, 2011

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

Don