Category Filter

Script to set time zone for Mac

A macOS device automatically configures the time zone under the Date & Time preferences depending on its current location. However, if you want to specify the time zone of a device over the air, you can get it done with the help of scripts. The
Execute Custom Script
action from Hexnode streamlines this process where you run customized scripts directly from the UEM console.

Disclaimer:

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

You can obtain a list of time zones from the device by running the following command on the Terminal:

sudo systemsetup –listtimezones #lists various time zones

Any of the listed time zones can be passed as $1 argument from the Hexnode console.

Alternately, you may consider the following script. It explicitly sets the device’s time zone to “Pacific/Ponape” and receives no argument.

Notes:

  • Enforcing the time zone on a device manually also adjusts the device clock based on the specified location.
  • 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.