We are trying to change the MacOS Date & Time setting "24-hour time" on 15.2 via a script.
There is nothing recent / working anywhere on the web. Is it impossible?
We are trying to change the MacOS Date & Time setting "24-hour time" on 15.2 via a script.
There is nothing recent / working anywhere on the web. Is it impossible?
Best answer by j120p
Ok, so the answer is as follows:
1) Use https://derflounder.wordpress.com/2014/06/01/understanding-payload-free-packages/ to create an installation package that runs at user-level
2) Install MacAdmins python https://github.com/macadmins/python
3) Use this script: (NOTE We used this approach: https://macmule.com/2014/11/19/how-to-get-the-currently-logged-in-user-in-a-more-apple-approved-way/)
#!/bin/bash
#!/Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3
loggedInUser=$(/Library/ManagedFrameworks/Python/Python3.framework/Versions/Current/bin/python3 -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\\n");')
defaults write /Users/"$loggedInUser"/Library/Preferences/.GlobalPreferences.plist AppleICUForce24HourTime -bool TRUE
exit 0
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.