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.
Scripting Language – Bash
File extension – .sh
Set Time Zone
1 2 3 4 5 |
#!/bin/sh #!/usr/bin/env bash sudo systemsetup -settimezone $1 #the argument $1 can take any value |
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.
1 2 3 4 5 |
#!/bin/sh #!/usr/bin/env bash sudo systemsetup -settimezone Pacific/Ponape |