Hiding the AirPort Menu Item

dstranathan
Valued Contributor II

All

Our desktops use Ethernet exclussivley, and thus I want to make sure the "AirPort" menu item doesnt appear on my desktop Macs after imagaing.

Obviosuly, I want the Wi-Fi menu Item to be active for laptop users, but there is no reason to show the Airport menu item to desktop users. "Out of sight, out of mind" - if you get my drift.

I dont want to remove or otherwise "kill" the actual Menu Item resource itself (located @ /System/Library/CoreServices/Menu Extras/AirPort.menu ), I just want to remove it from the system menu for new users when they log in for the first time (and possibly remove it from time-to-time).

I have found a few older scripts and/or one-liners online but none of them work.

Are are you handeling the Airport menu item?

9 REPLIES 9

mm2270
Legendary Contributor III

Use a Configuration Profile to manage the menubar items. It will make it not show up on each login if you don't enable it in the Config Profile, but the only downside to using a Config Profile is that by default it means the entire menubar items section becomes managed, i.e, if a user adds something custom to the menubar that isn't part of your configuration profile, on next logout/login/reboot, it will disappear and they'll need to add it in again. If that isn't much of a concern for you, then a profile would do it.
If "managing" it isn't something you want to do, you could look into converting the Profile with MCXtoProfile and making sure to use the --manage Once flag when converting it to a profile. https://github.com/timsutton/mcxToProfile
Or you could look at a script run at login to remove it.

davidacland
Honored Contributor II

We use a variation of this one that you could adjust to your needs:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>PayloadDescription</key>
    <string>Removes Bluetooth, Time Machine, Airport, Displays and Fast User Switching from the Menu Bar.</string>
    <key>PayloadDisplayName</key>
    <string>Remove items from the Menu Bar</string>
    <key>PayloadIdentifier</key>
    <string>uk.co.amsys.profile.menuextra.wifioff.20150224</string>
    <key>PayloadOrganization</key>
    <string>Amsys</string>
    <key>PayloadRemovalDisallowed</key>
    <true/>
    <key>PayloadScope</key>
    <string>System</string>
    <key>PayloadType</key>
    <string>Configuration</string>
    <key>PayloadUUID</key>
    <string>FA363A48-7F07-4620-9CAD-319DD828F386</string>
    <key>PayloadVersion</key>
    <integer>1</integer>
    <key>PayloadContent</key>
    <array>
        <dict>
            <key>PayloadContent</key>
            <dict>
                <key>com.apple.mcxMenuExtras</key>
                <dict>
                    <key>Forced</key>
                    <array>
                        <dict>
                            <key>mcx_preference_settings</key>
                            <dict>
                                <key>Bluetooth.menu</key>
                                <false/>
                                <key>Displays.menu</key>
                                <false/>
                                <key>TimeMachine.menu</key>
                                <false/>
                                <key>User.menu</key>
                                <false/>
                                <key>AirPort.menu</key>
                                <false/>
                                <key>delaySeconds</key>
                                <real>2</real>
                            </dict>
                        </dict>
                    </array>
                    <key>mcx_targets</key>
                    <array>
                        <string>user</string>
                    </array>
                </dict>
            </dict>
            <key>PayloadEnabled</key>
            <true/>
            <key>PayloadIdentifier</key>
            <string>uk.co.amsys.profile.menuextra.wifioff.20150224</string>
            <key>PayloadType</key>
            <string>com.apple.ManagedClient.preferences</string>
            <key>PayloadUUID</key>
            <string>562365BC-9533-423C-97DF-3A74F42B69EB</string>
            <key>PayloadVersion</key>
            <integer>1</integer>
        </dict>
    </array>
</dict>
</plist>

mm2270
Legendary Contributor III

BTW, the Menu Extras are stored in the user's com.apple.systemuiserver.plist file. They can be listed with something like:

defaults read com.apple.systemuiserver menuExtras

The above will only list the current user's menu extras of course, but technically, you can script removing entries in that array in the plist and then restarting the SystemUIServer process to reload the menu bar. I still think using a Configuration Profile would be the preferable way, but wanted to put that out there as well in case its helpful.

dstranathan
Valued Contributor II

A JAMF Profile my be acceptable for me in this situation, Ill have to play with it and see. I can kill a couple birds with one stone here (i.e.; hide AirPort but show the Clock, Volume and possibly KeyChain, etc). But I dont see a canned JAMF Profile for this - what Payload section is it under?

EDIT: Ahh its an old-school MCX setting, gotcha. That's how I'm manging my older Macs now (OD/MCX - migrating to JAMF in January if testing goes well). Im avoiding MCX going forward. So long, old friend. ;0)

@mm2270 , I did experiment with manually running a bash script for testing purposes, but I saw some odd results, even when restarting the SystemUIServer and logging out/in.

mm2270
Legendary Contributor III

@dstranathan Hmm, my bad! It isn't a built in profile option it seems. I was under the impression it was, but I also don't see it in any of the payloads, so we must have imported a custom setting to a profile and I just forgot. Sorry about the confusion!

dstranathan
Valued Contributor II

@davidacland

Your example is perfect for me. I changed the necessary key/value pairs. Testing it now. Thanks.

If I go the MCXtoProfile to route, Ill want to apply this for all users (globally). These menu bar settings are generally managed in the context of the user domain. I see your raw .plist's payload is scoped to "system". Will this ultimately be applied to all users? I know that "Profiles -I -F /path/to/mobileconfig.file" command will apply to the computer domain, but will the profile apply accordingly?

apizz
Valued Contributor

I've been trying to figure out how to do this as well. @mm2270, I'm curious how you've configured things using a custom setting. We don't do anything with Managed Preferences in the JSS, so I'm trying to configure a Config Profile to do this on just our lab machines, which are hard wired to our network.

mm2270
Legendary Contributor III

@aporlebeke We use a Config with a single Custom Settings payload that uses a Preference Domain of com.apple.mcxMenuExtras and the following two settings:

TimeMachine.menu=false HomeSync.menu=false

Because those are the only 2 menu extras we don't want clients to have in the menu.

I'm pretty sure we created this by uploading a plist file with those settings already in place in the file, but its been a while now so I don't exactly recall.

davidacland
Honored Contributor II

Thats correct, its applied at the computer (system) level but apples to all users on the device.