Category filter
Execute custom scripts to set data 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
Set Date and Time
1 2 3 4 5 |
#!/bin/sh /sbin/ date $1 |
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’