Find the UUID for your machine

Ief2 and Nigel Garvey helped me out with this little routine to find the UUID of a machine through System Profiler:

do shell script “system_profiler | grep ‘Hardware UUID’”

This can be used in a routine to assign designated software to a specific machine and thereby limiting the use of the software to authorized machines only.

Thanks Again Guys,
Dan

And if you don’t want to wait twelve seconds or more for the result, you can limit “system_profiler”'s data gathering to just the hardware by using the “SPHardwareDataType” parameter:


do shell script "system_profiler SPHardwareDataType | grep 'Hardware UUID:'"
set uuid to text ((offset of ":" in result) + 2) thru -1 of result

nitpicking

awk instead of grep can do the filter task directly


set uuid to do shell script "system_profiler SPHardwareDataType | awk '/Hardware UUID:/ {print $NF}'"

No. That’s great. Thanks, Stefan. :cool:

Hello.

I couldn’t resist. :slight_smile:
Nitpicking a little bit more, and maybe saving an odd millisecond or two, if the processor feels for it at that moment.

/usr/sbin/system_profiler SPHardwareDataType | /usr/sbin/sed -n 's/Hardware UUID:\(.*\)/\1/p'

I think I read some place that hardware serial numbers tend to break for odd reasons like hardware defects and hardware upgrades, and as such are not reliable for Digital Rights Managment DRM

What would you suggest that would be better for DRM?
Thanks
Dan

I have an old Intel iMac (one of the 1st ones). It had the logic board replaced early on. It lost its Serial Number.* It now has “SystemSerialNumb” instead. It does not have a Hardware UUID, does not have the field. It is running 10.4.11.

So maybe Hardware UUID is a Leopard addition. I don’t know whether it can be lost. Likely someone does.

  • I read somewhere that if you ask, they will keep (restore) your Serial Number during these kinds of repairs. I never had any kind of problem with the machine or its (many) applications afterwards, so it seemed a moot point. Apparently applications use more intense methods. But it might matter for a homemade security method.

Fenton:
does this also fail?

set UUID to do shell script "ioreg -rd1 -c IOPlatformExpertDevice | grep -i 'UUID' | cut -c27-62 | awk {'print tolower()'}"

(It’s not mine…)

Yes, it also fails. There is no UUID. That machine was one of the 1st Intel iMacs. I ordered it just before they announced Intel chips in Macs, and they asked me if I wanted the new (never seen before) Intel verson.

So, after the logic board was replaced, it has that standard text as a “serial number” and was too early for a UUID. But registered software always worked on it, so I didn’t really care.