OS X - Create Hardware report SPX and save it to a AFP share
Published: 02-06-2013 | Author: Remy van Elst | Text only version of this article
❗ This post is over ten years old. It may no longer be up to date. Opinions may have changed.
This script creates a OS X hardware report (an SPX file) and saves it to a AFP share. This is usefull when you are rolling out new machines. Run this script via Apple Remote Desktop and you have all your administration in your AFP share, which you can later put in your CMDB. The report has all the hardware data, from firmware, serial number, model, MAC addresses, disk and memory information, in short everything you need for your CMDB and support contracts.
Recently I removed all Google Ads from this site due to their invasive tracking, as well as Google Analytics. Please, if you found this content useful, consider a small donation using any of the options below:
I'm developing an open source monitoring app called Leaf Node Monitoring, for windows, linux & android. Go check it out!
Consider sponsoring me on Github. It means the world to me if you show your appreciation and you'll help pay the server costs.
You can also sponsor me by getting a Digital Ocean VPS. With this referral link you'll get $100 credit for 60 days.
This is the script:
#!/bin/bash mkdir /Volumes/hardware-report/; mount -t afp afp://AFPUSER:AFPPASSWORD@10.2.38.1/Hardware /Volumes/hardware-report; mkdir -p "/Volumes/hardware-report/`hostname -s`"; system_profiler -detailLevel full -xml > "/Volumes/hardware-report/`hostname -s`/Report-for-`hostname -s`.spx"; umount /Volumes/hardware-report; unlink $0
Change the username, password, share IP/Hostname and share path. Then copy it to
all the machines via Apple Remote Desktop, in the
/tmp folder. Now via ARD
execute it as root. You should see new folder appear in the AFP share based on
the machine hostname. In there you find the .SPX files which you can use for
Note that the last line,
unlink $0 removes the script after it ran. So the
username and password don't stay on the machine.