Skip to main content
Solved

Get OS Build Version via Extension Attribute


Forum|alt.badge.img+3

I can see that you can pull the OS Build version by running "sw_vers -BuildVersion" from Terminal. I would like to gather the output of this or all the info from "sw_vers" as an extension attribute to build smart groups on. What would be the best way to get this into extension attributes? I see you can build it via a script but still getting into OS X scripting and any help would be appreciated.

Best answer by mm2270

Define a variable in your script that has the command run that gets that information as its result. In the Extension Attribute you echo back the above variable contained within <result> & </result> tags surrounded in quotes. Make sure to use the variable name with a "$" in front within the echo line

#!/bin/sh
OSbuild=`sw_vers -buildVersion`
echo "<result>$OSbuild</result>"
View original
Did this topic help you find an answer to your question?

8 replies

mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • Answer
  • January 28, 2013

Define a variable in your script that has the command run that gets that information as its result. In the Extension Attribute you echo back the above variable contained within <result> & </result> tags surrounded in quotes. Make sure to use the variable name with a "$" in front within the echo line

#!/bin/sh
OSbuild=`sw_vers -buildVersion`
echo "<result>$OSbuild</result>"

Forum|alt.badge.img+23
  • Esteemed Contributor
  • 850 replies
  • January 28, 2013

What mm2270 suggests will work, but I'm curious why you need this as an extension attribute? This info is reported separately in the inventory, certainly in Casper 8.62.


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • January 28, 2013

@franton, yep, it shows up in the details section of a computer inventory. For some reason though you can't add a column displaying it in a search, unless I'm just missing it.
And the trick to actually building a query or a Smart group on that information is to just use the "OS Configuration Information > Operating System Version > is" or "is like" and then the build version string, such as "11G63" for all 10.7.5 Macs. It'll pull them up, but again, you can't display the column in a search result. The OP may want to have that for overall reports and the EA would give him that ability.


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 7 replies
  • January 28, 2013

Worked like a charm! Thank you very much! I can tweak this a bit to get other results as well.

Thanks again!


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 7 replies
  • January 28, 2013

I was trying to build a Smart Group with the actual OS build numbers as some people have 10.8.2 and some don't have Supplemental Update 2 and wanted to target those and didn't see a way to build the Smart Group based on build number


mm2270
Forum|alt.badge.img+16
  • Legendary Contributor
  • 7880 replies
  • January 28, 2013

@cfritzy, as I said, its not so obvious, but it should work to plug the build you are or aren't trying to match into the "OS Configuration Information > Operating System Version > is" under criteria. It does work, at least in most cases.


Forum|alt.badge.img+3
  • Author
  • New Contributor
  • 7 replies
  • January 28, 2013

I'll give it a shot. I am running 8.62 so I will try it out. Thanks again all for the information, very helpful!


chris_kemp
Forum|alt.badge.img+20
  • Jamf Heroes
  • 339 replies
  • January 28, 2013

Good stuff. I did a similar thing here to re-create the OS X version with an indicator of whether the machine is running in 32- or 64-bit mode.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings