MCX or Policy to set date and time automatically on Mac computer

LloydStarTech
New Contributor

Is there a way ( via a policy or MCX ) to force the date and time to sync to time.apple.com for managed computers?

I looked through the MCX templates and didn't see anything.

Anyone try to do this before?

2 ACCEPTED SOLUTIONS

wlcasey
New Contributor III

You can run do this via shell script. There are just a few commands that you need:

systemsetup -setusingnetworktime on # this confirms that network time service is turned on
systemsetup -setnetworktimeserver time.apple.com # this sets the time server

and

ntpdate -u time.apple.com # this is the one that actually tells the date function to check in with the time server

I found that sometimes the timezone placeholder (/etc/localtime) gets corrupt for some reason. You can reset the time zone with...

systemsetup -settimezone America/New_York # sets timezone to ET

I hope this helps.

Wayne

View solution in original post

mscottblake
Valued Contributor

You can also do this via MCX:

Domain: com.apple.MCX
Key Name: timeServer
Key Type: string
Value: time.apple.com

View solution in original post

3 REPLIES 3

wlcasey
New Contributor III

You can run do this via shell script. There are just a few commands that you need:

systemsetup -setusingnetworktime on # this confirms that network time service is turned on
systemsetup -setnetworktimeserver time.apple.com # this sets the time server

and

ntpdate -u time.apple.com # this is the one that actually tells the date function to check in with the time server

I found that sometimes the timezone placeholder (/etc/localtime) gets corrupt for some reason. You can reset the time zone with...

systemsetup -settimezone America/New_York # sets timezone to ET

I hope this helps.

Wayne

mm2270
Legendary Contributor III
sudo systemsetup setusingnetworktime on

will set it to On. Just run that in a policy. There may be an MCX or profile function, but not sure.

Edit: Wayne beat me to it, and provided more info. So follow his post. :)

mscottblake
Valued Contributor

You can also do this via MCX:

Domain: com.apple.MCX
Key Name: timeServer
Key Type: string
Value: time.apple.com