Modify time settingsSolved

Participant
Discussion
1 month ago

Hey everyone, I’m managing a bunch of macOS devices (Monterey), and I’ve hit a bit of a snag. Most of the devices only show the time in hours and minutes—no seconds. On top of that, we use a 12-hour clock format, but some devices don’t display AM/PM. It’s super exhausting to manually go into each system and fix this. Does anyone have any scripts or methods to tackle these issues? Would really appreciate some help here! 

Replies (6)

Marked SolutionPending Review
Participant
1 month ago
Marked SolutionPending Review

Hey @luuk, I think a simple defaults write command should do the trick:

Marked SolutionPending Review
Participant
1 month ago
Marked SolutionPending Review

Oh yes, yes, the command works fine when run directly in the terminal, but when I push it using Hexnode’s execute custom script action, it fails. Can anyone help me with this? 

Marked SolutionPending Review
Participant
1 month ago
Marked SolutionPending Review

Oh no worries, I ran into this issue a while back. When executing defaults write commands via Hexnode’s  execute custom script action, the script runs in a root level rather than under the logged-in user. Since defaults modifies user-specific preferences, it may not take effect unless explicitly executed in the user’s session. Using launchctl asuser ensures that the command runs within the correct user context, resolving this issue

Here’s a modified script that should work:

Marked SolutionPending Review
Participant
1 month ago
Marked SolutionPending Review

Hey there, I was wondering if there’s a script to change the time format to 24-hour and make the time uniform across every device in our organization. I tried some scripts, but they didn’t work. 

Marked SolutionPending Review
Participant
1 month ago
Marked SolutionPending Review

Hello @ryker,

You could use a similar command to achieve this:

And if you need to revert back to the 12-hour format, then:

I’m not sure about the latest versions, but it worked for Monterey. Let me know if it helps!

Marked SolutionPending Review
Participant
4 weeks ago
Marked SolutionPending Review

Thank you! We mostly use monterey or earlier versions, and now every device is updated perfectly. Really appreciate the help! 

Save