Posted on 01-11-2022 03:21 PM
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.
Posted on 01-11-2022 10:42 PM
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
Posted on 08-04-2022 02:38 PM
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!
Posted on 01-10-2023 01:05 PM
I have been using this exact script on my Jamf server for years