Set Time zone on Monterey OS + M1 chip Mac

choudhary
New Contributor II

Hi, 

Can anyone help me to provide the latest "SetTimeZone and SetTimeServer" Jamf script? as their old scripts are not working in M1+Monterey OS. Scripts are executing without any error but Time Zone>>"Set time zone automatically using current location" tick is not not enabled. 

3 REPLIES 3

karthikeyan_mac
Valued Contributor

Set time zone automatically using current location works based on location services. If the location services is turned off this will not be enabled. You can use the below script to turn on location services (requires restart) and then Set time zone automatically using current location will enable.

#!/bin/bash

## enabling location services
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd LocationServicesEnabled -int 1

uuid=$(/usr/sbin/system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -c22-57)
/usr/bin/defaults write /var/db/locationd/Library/Preferences/ByHost/com.apple.locationd.$uuid LocationServicesEnabled -int 1

## configure automatic timezone
/usr/bin/defaults write /Library/Preferences/com.apple.timezone.auto Active -bool YES
/usr/bin/defaults write /private/var/db/timed/Library/Preferences/com.apple.timed.plist TMAutomaticTimeOnlyEnabled -bool YES
/usr/bin/defaults write /private/var/db/timed/Library/Preferences/com.apple.timed.plist TMAutomaticTimeZoneEnabled -bool YES
/usr/sbin/systemsetup -setusingnetworktime on
/usr/sbin/systemsetup -gettimezone
/usr/sbin/systemsetup -getnetworktimeserver

 

To all, we have had some interns help with our 250, refresh. They forgot to adjust location time, at least half are pacific time. Thanks for posting!

 

 

 

 

I have been using this exact script on my Jamf server for years