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.

Script to retrieve 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:

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

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:

system_profiler –listDataTypes

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