Macintosh Serial Number - Retrieved Property

(imported topic written by upinya91)

I’ve been trying to write a Retrieved Property to pull Mac serial numbers, but it isn’t easy. The Mac inspector docs only go so far in explaining how to interact with the IOKit Registry.

From the Apple technical documentation (http://developer.apple.com/technotes/tn/tn1103.html):

However, starting with Panther, the serial number is presented in the property IOPlatformSerialNumber of the IOPlatformExpertDevice node in the I/O Registry.

Also, this link has a command-line script in a Terminal window that outputs the system serial number (http://www.jaharmi.com/2008/03/15/to_get_mac_serial_numbers_scripts_is_ioreg_or_system_profiler_faster):

$ ioreg -l | awk ‘/IOPlatformSerialNumber/ { split($0, line, “”"); printf("%s\n", line[4]); }’

The above command, for what it’s worth, works perfectly. But outputting the result into something the BigFix client can do something with, well, there’s the rub. I played around with some BigFix syntax, and the closest I could get was, in the Mac QandA app:

Q: classname of service plane of iokit registry

classname of service plane of iokit registry

A: IOPlatformExpertDevice

T: 622024648

Within a Terminal window, using the “ioreg” command, I could get the following:

hostname:~ username$ ioreg -c IOPlatformExpertDevice

±o Root <class IORegistryEntry, retain 15>

±o MacBookPro3,1 <class IOPlatformExpertDevice, registered, matched, active, busy 0, retain $

| {

| “IOBusyInterest” = “IOCommand is not serializable”

| “IOInterruptControllers” = (“io-apic-0”)

| “IOPlatformSerialNumber” = “W873162xxxx”

…etc…

There it is, IOPlatformSerialNumber. I feel I’m getting really close, anyone have any suggestions on how to cull that value out using BigFix syntax? I’m sure it’s something easy…

Thanks!

Peter

(imported comment written by juancb91)

Peter,

You can get the system serial number using the following bit of relevance:

Q: string “IOPlatformSerialNumber” of dictionary of service plane of iokit registry

A: G8519EVxxxx

T: 4226261037

-Juan