Posted on 02-15-2014 05:40 PM
It took me a long time to find this code so I figured I would share it.
To enable the option to "Show VPN on the Menu Bar" I used the code below.
defaults write com.apple.systemuiserver menuExtras -array-add "/System/Library/CoreServices/Menu Extras/vpn.menu"
killall SystemUIServer -HUP
Posted on 05-07-2019 06:27 AM
Hello JAMF Nation,
Has anyone actually been able to get this working?
I tried
open "/System/Library/CoreServices/Menu Extras/vpn.menu"
It was pushed via Policy and get an Error. However when I run the command via terminal it works as intended.
Has anyone come up with a better solution on this piece?
Thanks all.
Posted on 05-07-2019 06:31 AM
@CorpIT_eB I use a config profile to add the VPN menu icon, it's an MCX profile so the user won't see any change take effect until a logout or restart. I have a few other menu extras in this profile, but you can edit that out to just have the VPN icon.
Posted on 05-07-2019 06:59 AM
@sshort Forgive my ignorance I am very new to being a JAMF Admin where would this MCX profile go?
In Other words I take your XML script there edit it for just VPN then where would I upload it for testing I am unfamiliar with .plists and XML conversions to profiles.
Total NOOB here so steps would be crucial in my learning processes.
Thanks Again.
Posted on 05-07-2019 07:17 AM
@CorpIT_eB copy and paste that into your preferred text editor (and take out other menu items you don't want to control) then save the document with a .mobileconfig
file extension. Check out this post on signing profiles, then upload to Jamf.
Posted on 10-10-2019 12:02 PM
So not sure if anyone has noticed but this plist at least in my environment macOS 10.14.6 is no longer adding the icon to the menu bar. It still runs ok and adds the configuration itself but it's not adding the Icons to the menu bar any longer. Does anyone know if they have changed the switches for these checkboxes?
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadContent</key>
<dict>
<key>com.apple.systemuiserver</key>
<dict>
<key>Set-Once</key>
<array>
<dict>
<key>mcx_preference_settings</key>
<dict>
<key>NSStatusItem Visible Siri</key>
<false/>
<key>NSStatusItem Visible com.apple.menuextra.airplay</key>
<true/>
<key>NSStatusItem Visible com.apple.menuextra.volume</key>
<true/>
<key>NSStatusItem Visible com.apple.menuextra.vpn</key>
<true/>
<key>__NSEnableTSMDocumentWindowLevel</key>
<true/>
<key>menuExtras</key>
<array>
<string>/System/Library/CoreServices/Menu Extras/Battery.menu</string>
<string>/System/Library/CoreServices/Menu Extras/AirPort.menu</string>
<string>/System/Library/CoreServices/Menu Extras/Volume.menu</string>
<string>/System/Library/CoreServices/Menu Extras/Displays.menu</string>
<string>/System/Library/CoreServices/Menu Extras/VPN.menu</string>
</array>
</dict>
</dict>
</array>
</dict>
</dict>
<key>PayloadDisplayName</key>
<string>Custom: (com.apple.systemuiserver)</string>
<key>PayloadEnabled</key>
<true/>
<key>PayloadIdentifier</key>
<string>com.apple.mdm.macserver-imac.local.e619bbc0-3444-0136-d464-2c87a33a6849.alacarte.customsettings.04410560-3445-0136-d466-2c87a33a6849</string>
<key>PayloadType</key>
<string>com.apple.ManagedClient.preferences</string>
<key>PayloadUUID</key>
<string>04410560-3445-0136-d466-2c87a33a6849</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</array>
<key>PayloadDescription</key>
<string>Add shortcuts to the menu bar</string>
<key>PayloadDisplayName</key>
<string>Settings for menubar_icons</string>
<key>PayloadEnabled</key>
<true/>
<key>PayloadIdentifier</key>
<string>com.apple.mdm.macserver-imac.local.e619bbc0-3444-0136-d464-2c87a33a6849.alacarte</string>
<key>PayloadOrganization</key>
<string>CompanyName</string>
<key>PayloadRemovalDisallowed</key>
<false/>
<key>PayloadScope</key>
<string>System</string>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadUUID</key>
<string>e619bbc0-3444-0136-d464-2c87a33a6849</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</plist>
Posted on 10-11-2019 08:43 AM
After deploying the actual VPN configuration, try running this in a script or under Files & Processes:
user=$(stat -f %Su /dev/console); sudo -u $user open "/System/Library/CoreServices/Menu Extras/vpn.menu"
Still works on 10.14, haven't tested on Catalina yet.
Posted on 10-15-2019 07:11 AM
@pete_c That definitely works in Catalina.
Posted on 11-20-2019 08:10 AM
@pete_c If I wanted to add more icon could you pipe in other icons like Volume, and Battery Percentage?
Posted on 03-10-2020 06:10 AM
hello everyone, I would like to create this policy to automatically show the VPN icon to the menubar.
@pete_c command works perfectly by pasting in the terminal, BUT, it seems I cannot configure correctly the script in JAMF platform.
I have attached the trigger settings, but even trying with other options (login/startup, etc) it is not applied.
any hint?
ty vm!