Category filter

Execute custom scripts to set date and time for macOS devices

Changing the date or time of the devices requires the user to customize the Date & Time settings from the System Preferences. As an administrator, if you want to modify the date or time of the device without involving direct user interaction, the
Execute Custom Script
action helps you. For instance, the following script forces the date and time on a macOS device.

Scripting Language – Bash

File extension – .sh


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

Set Date and Time

Here, enter the argument $1 in the format

abcde, where a, b, c, d, and e are two-digit numbers indicating:

a – month of the year

b – day of the month

c – time in hours

d – time in minutes

e – year

Suppose, to set the date and time of a device to 12 Aug 2021 9:12 am, the argument takes the following form: ‘0812091221’


  • 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