Skip to main content Logo (IEC resistor symbol) logo

Quis custodiet ipsos custodes?
Home | About | All pages | RSS Feed | Gopher

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

Table of Contents

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.

If you like this article, consider sponsoring me by trying out a Digital Ocean VPS. With this link you'll get $100 credit for 60 days). (referral link)

This is the script:

mkdir /Volumes/hardware-report/;
mount -t afp afp://AFPUSER:AFPPASSWORD@ /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 your administration.

Note that the last line, unlink $0 removes the script after it ran. So the username and password don't stay on the machine.

Tags: afp , apple , apple-remote-desktop , ard , cmdb , hardware-report , mac , os-x , sleep , software