Nice. Another way that we usually employ in scripts is to simply do an 'open <path to menu item>' and it will add it to the menu bar for the user.
@chriscollins][/url
I had tried doing it that way, but found it wasn't working consistently for me, but the command I posted was working every time. I guess its a case of more than one way to skin a cat.
Thanks
Shaun
@ShaunM9483 I totally agree. Your way is definitely guaranteed to be consistent and is what I think I'll use going forward. Thanks for posting :)
@ShaunM9483 how do you get this for all users? user template?
@wmateo
We have moved away from this method in favor of a config profile we converted from an MCX.
When we were using this we ran a policy scoped to our laptops which was enforced at check in - once per user and also had a self service policy for this as well set to on-going. We added the command above to the advance menu in the policy to enable the VPN menu bar on machines.
Hope this helps
Shaun
FWIW, we deploy the above to a smart group with criteria "Model is like MacBook" via a Config profile.
Hi,
I tried running below commands manually but it is still not adding VPN icon in menu bar. Mac OS is 10.9.5
defaults write com.apple.systemuiserver menuExtras -array-add "/System/Library/CoreServices/Menu Extras/vpn.menu"
killall SystemUIServer -HUP
Anything which I'm missing here?
Thanks
I tried running below command & it is working just fine.
open "/System/Library/CoreServices/Menu Extras/vpn.menu"
However I'm bit confused from above replies that this command is not consistent enough.
Please suggest
Hi,
Using the open command is only likely to work if the user is logged in. As its not writing a preference key I don't think it would stick if the Mac was rebooted or the user logged out.
I would recommend using a custom configuration profile to set this one.
Hi,
Thanks for your reply. Please can you guide me how to use/configure a custom configuration profile to set this option. If there is any article/forum for this then it would be a great help.
Thanks again.
Hi @sidhu_navdeep,
I've added a config profile to the public part of our Github: https://github.com/amsysuk/public_config_profiles
You can upload it straight into your JSS. Just test it out before you scope to all devices, in case it doesn't do what you need!
Thank you Justin for this wonderful article. Much appreciated.
I've just one quick question - I hope it will not remove the icons (battery, keyboard etc.) which are already showing in Menu bar because my requirement is to just add VPN icon in menu bar.
Thanks again!
@sidhu_navdeep I'm not sure. On my video at the bottom of the page I did not have battery/keyboard menu items enabled when deployed.
You'll need to test. Also, a Byhost file gets created when changing Menu Items manually:
justinrummel@Rummel-MBPr ~/D/G/jr.com-hpstr> defaults read ~/Library/Preferences/ByHost/com.apple.systemuiserver.0A64FD5C-7634-5BE4-B298-42354ED1FCE7.plist
{
dontAutoLoad = (
"/System/Library/CoreServices/Menu Extras/Clock.menu",
"/System/Library/CoreServices/Menu Extras/Battery.menu",
"/System/Library/CoreServices/Menu Extras/AirPort.menu"
);
}
Hi @sidhu_navdeep, did the config profile not work?
Hi David,
The config profile shared by you did work but unfortunately it removed battery & keyboard icon from the menu bar. Any idea how can we retain these icons because I'm sure these icons might be already enabled by end users.
Have you tried setting the key at the top from "Forced" to "Set-Once"? that is a bit more of a gentle approach.
I'm sorry...how do I do that? Where is the option?
Just towards the top of the text in the mobileconfig file it should say <key>Forced</key>. Try it as <key>Set-Once</key> instead.
Ah ok, thanks :-)
I'll give it a shot & share the feedback on Monday. Have a great weekend!
Hi David,
I tried modifying mobileconfig file however when I try to upload the updated file, it is not allowing me to save because Property List File is missing. When I try uploading your original file, it gets uploaded without any problem. How can I resolve this please?
Sorry for all this trouble as I don't know much about this Casper/Mac & I'm learning the stuff here.
Thanks
Hi, it sounds like the file is getting corrupted. What are you using to edit it?
Hi David,
Sorry I was pulled away by an urgent issue & could not respond. I managed to change the settings i.e. Set-Once however it is still removing battery & keyboard icons from the menu bar.
I tried to set this up via Managed Preferences (user level enforced) but it is also not getting applied properly.
Any further suggestions, please?
Thanks for all your help.
@justinrummel
I found the same things you did as well. However, I'm doing this in 10.10.4, and weirdly enough I cannot get both the Status AND Time to be checked. It's the weirdest thing.
I also noticed that if you had the VPN.menu after the Clock.menu in the com.apple.systemuiserver.plist that it would actually show up between the clock and spotlight which is a really strange place to have it.
So here's what I ended up with in my mobileconfig file:
<?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>PayloadContent</key>
<array>
<dict>
<key>PayloadContent</key>
<dict>
<key>com.apple.networkConnect</key>
<dict>
<key>Forced</key>
<array>
<dict>
<key>mcx_preference_settings</key>
<dict>
<key>VPNShowStatus</key>
<true/>
<key>VPNShowTime</key>
<true/>
</dict>
</dict>
</array>
</dict>
</dict>
<key>PayloadEnabled</key>
<true/>
<key>PayloadIdentifier</key>
<string>MCXToProfile.18a8b2bf-ff46-4265-973a-30e6364a8359.alacarte.customsettings.7fdcc843-9f91-43e2-9135-797633c7a202</string>
<key>PayloadType</key>
<string>com.apple.ManagedClient.preferences</string>
<key>PayloadUUID</key>
<string>7fdcc843-9f91-43e2-9135-797633c7a202</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
<dict>
<key>PayloadContent</key>
<dict>
<key>com.apple.systemuiserver</key>
<dict>
<key>Forced</key>
<array>
<dict>
<key>mcx_preference_settings</key>
<dict>
<key>menuExtras</key>
<array>
<string>/System/Library/CoreServices/Menu Extras/VPN.menu</string>
<string>/System/Library/CoreServices/Menu Extras/Clock.menu</string>
</array>
</dict>
</dict>
</array>
</dict>
</dict>
<key>PayloadEnabled</key>
<true/>
<key>PayloadIdentifier</key>
<string>MCXToProfile.18a8b2bf-ff46-4265-973a-30e6364a8359.alacarte.customsettings.c4291a15-49fd-42cf-a849-2ea1f62a0d27</string>
<key>PayloadType</key>
<string>com.apple.ManagedClient.preferences</string>
<key>PayloadUUID</key>
<string>c4291a15-49fd-42cf-a849-2ea1f62a0d27</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</array>
<key>PayloadDescription</key>
<string>Included custom settings:
com.apple.networkConnect
com.apple.systemuiserver
</string>
<key>PayloadDisplayName</key>
<string>Company - OS X VPN Menu</string>
<key>PayloadIdentifier</key>
<string>OS X VPN Menu</string>
<key>PayloadOrganization</key>
<string>Company</string>
<key>PayloadRemovalDisallowed</key>
<true/>
<key>PayloadScope</key>
<string>System</string>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadUUID</key>
<string>18a8b2bf-ff46-4265-973a-30e6364a8359</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</plist>
Can you confirm whether your mobileconfig works in 10.10.4?