Category filter

Script to retrieve System Information on Mac

The System Information app is the information hub where all the detailed specifications and information regarding a macOS device can be viewed. As a system admin, there may occur situations where you need to gather necessary information about your Mac endpoints from the System Information app. Using Hexnode’s Execute Custom Script action, you can remotely retrieve all the required information using the shell command detailed in this document.

Disclaimer:


The Sample Scripts provided below are adapted from third-party Open-Source sites.

Retrieve Mac’s System Information

The system_profiler command will create a complete report of the Mac’s System Information. After successfully executing the above command, you can view the system report by navigating to Action History on the device summary page and clicking Show Output.

If you need only the information about specific system hardware or software, running the system_profiler command alone would not be very efficient as it can be time-consuming, especially if the device is slow or has an older OS version. Instead, you can run a more specific command by specifying the required Data Type.

To get a list of all the available data types associated with a Mac, you can invoke the listDataTypes argument along with the system_profiler command:

You can then specify the required Data Type in the Arguments space when running the following command from the Hexnode portal:

For example, to get information about the audio devices associated with a Mac, SPAudioDataType can be entered as the argument while executing the script from the Hexnode portal. Alternatively, you can run the following command directly:

system_profiler SPAudioDataType

Below are a few arguments that you can use to fetch specific information about the Mac:

Argument  Retrieved Information
SPHardwareDataType Hardware overview
SPSoftwareDataType System software information
SPBluetoothDataType Bluetooth devices associated with the Mac
SPUSBDataType List all USB devices associated with the Mac
SPDisplaysDataType Graphics card (GPU) information
SPStorageDataType Information about the Mac’s storage drives
SPPrefPaneDataType Information about the different System Preferences panes

Script to save the System Information report

To save the system information report in a text-based file on your Mac endpoint, run the below command.

Notes:

  • It is recommended to manually validate the script execution on a system before executing the action in bulk.
  • Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.

  • Sample Script Repository