Duplicate Menu Bar Icons

Cyrano5
New Contributor II

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?

6 REPLIES 6

franton
Valued Contributor III

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.

Cyrano5
New Contributor II

bb1489c9bcad4f12beb77fd6b4241a1a
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.

franton
Valued Contributor III

How are you setting the Keychain.menu to load in the first place? The cause is probably in the policy/code you're using.

Cyrano5
New Contributor II

I checked and there is an ongoing login policy to set the padlock via script.

It was a simple

/bin/bash

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?

franton
Valued Contributor III

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.

franton
Valued Contributor III

Oh you'll have to manually quit the duplicates or you run the risk of them continue to load.