Posted on 10-21-2016 01:49 PM
It was common for our machines to display duplicate icons in the menu bar when logging into a machine for the first time. Rebooting the machine would normally make this issue go away.
We have seen machines now where the duplicate icons remain after reboot and persist.
They seem to be OS X related items as well..ie..Time, Wifi Icon, Sound, Keychain Lock Icon, Logged in User.
Has anyone else experienced this or now how to make it so that it doesn't happen in the first place?
Posted on 10-25-2016 01:24 AM
This is a "per user" setting. The preference file to check is this one:
defaults read /Users/ username /Library/Preferences/com.apple.systemuiserver menuExtras
If you have a script or something that's adding existing items, you'll need some logic to make sure it doesn't repeatedly add the same icons over and over. I once did it with this code:
# Get the Username of the currently logged user
loggedInUser=`python -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 + "
");'`
# Menu bar Keychain lock screen
keyc=$( defaults read /Users/$loggedInUser/Library/Preferences/com.apple.systemuiserver menuExtras | grep -q "Keychain.menu" ; echo $? )
if [ $keyc = "1" ];
then
# Keychain menubar app isn't running, so load it now
open /Applications/Utilities/Keychain Access.app/Contents/Resources/Keychain.menu
fi
However these days it's probably easier to manage it with a custom config profile ;) Set it once and forget.
Posted on 10-27-2016 07:56 AM
Thank you for the input.
Here is what we have starting seeing recently.
Again, this was common the first time someone would login, but a reboot would fix it and it wouldn't be an issue again.
Posted on 10-27-2016 08:12 AM
How are you setting the Keychain.menu to load in the first place? The cause is probably in the policy/code you're using.
Posted on 10-27-2016 08:28 AM
I checked and there is an ongoing login policy to set the padlock via script.
It was a simple
open '/Applications/Utilities/Keychain Access.app/Contents/Resources/Keychain.menu'
Could / Can this one policy cause the duplicates with the time, WiFi, Display icons as well?
Posted on 10-27-2016 08:30 AM
Yes that's the exact cause for the keychain.menu issue. I can't vouch for the other icons however.
You can either try using the code snippet I posted above, or make the policy once per user per machine.
Posted on 10-27-2016 08:33 AM
Oh you'll have to manually quit the duplicates or you run the risk of them continue to load.