Can BigFix query nvram variable on OSX?

(imported topic written by intrepdmind91)

All,

I have a weird one for you and am looking for suggestions. We are trying to deploy asset tag information on our Mac OSX computers that are running the latest version of Leopard. There is no hidden “BIOS” setting that we could think of that could hold this information as there is on Dell machines (WMI AssetTag string). The closest thing we could think to do was to create a variable in the nvram, and query that variable. This is what we have so far, and it works well but I have no clue how to get BigFix to query this variable, if it’s even possible at all:

//To set the variable

sudo nvram VARNAME=VARVALUE

example: sudo nvram AssetTag=000000

//to view:

nvram -p

//to view with filters nvram -p | grep VARNAME

//will give you the variable name and value

//example:

nvram -p | grep Asset Tag

AssetTag 000000

Any thoughts on how to have BigFix query this var? Any other ideas on how to slipstream a custom ID tag (not just the Apple Serial) onto a Mac other than creating nvram entries? Our current thinking is that our end-user’s skill level would not include the knowledge of how to reset the nvram, nor how to query it so anything we store there would be relatively safe.

Thanks for your feedback.

(imported comment written by NoahSalzman)

A general rule with BigFix is “anything that can be done on the command line (of any OS) can be done by BigFix” with the caveat that you have to do it as SYSTEM or root.

So, yes, you can use BigFix’s ActionScript to run any and all of the one-liners you have used as examples. Also, you probably want to store the VARNAME as a Retrieved Property so it can be used in BigFix reports.

I would start by reading this:

http://support.bigfix.com/bes/misc/customactions.html

(imported comment written by intrepdmind91)

Noah,

This seems to make sense, but I’m not really looking to have BigFix “run” anything per-se. On windows (specifically Dell machines) BES is capable of querying WMI_BIOS32 directly, and reporting anything stored there.

I’m essentially looking to see if BES can simply look at the strings of information that are already stored in NVRAM (the info is already there, I just need BES to call it up).

I’ve looked through the custom authoring site, as well as the Properties of my BES server (subscribes to all sites that have anything to do with Mac OSX), and haven’t really found anything as far as code that I might be able to reverse engineer.

The only thing I can currently think to do is to write a small executable that would call the entire contents of NVRAM and dump it somewhere as a text file. BES is really good at reading text files and reporting whatever I want out of them, but this seems like a fairly sloppy way of getting the information I’d like out of the system. Are there any other ways to approach this, or are we stuck just piping the info into a .txt file and reading it from there?

(imported comment written by rzm10291)

Hello, you can use the iokit registry to view some of the nvram options. See this analysis for examples:

http://bigfix.me/analysis/details/2994552

1 Like

(imported comment written by NoahSalzman)

You are on the right track, but there is no need to write a small executable (that is the role of the BigFix Agent). You need to create a BigFix Task that writes out the data to a file and then you create an Analysis to read in the data.

The Task action would be something like:

run nvram -p | grep AssetTag > /tmp/asset_info.txt

(Bonus points for using sed to get just the value without the “AssetTag” string in the text file.)

Then, if it is only the AssetTag value in the text file, you can create a custom Analysis that has this relevance:

lines of file “/tmp/asset_info.txt”

(imported comment written by intrepdmind91)

Thanks noah,

This works wonderfully. I appreciate your help~