We have implemented some network restrictions on our mac devices so the users will not fiddle with those settings and mess it up. So we want to remotely turn on the VPN whenever its required. The VPN icon on the menu bar gives them access to the VPN networks. So is there a way to remove that icon from there.
Remove VPN icon from menu bar Solved
Tags
Replies (3)
There is an option under VPN profile in the network tab. Uncheck this option to remove the disable the icon. And as a shortcut you can just click and drag the icon out while pressing on the cmd button.
These all options work. But im looking for something that is similar to a script or configuration file. We have around 71 devices, so unchecking the option independently on each device is out of the question. These are already deployed devices.
Hey @abel,
Welcome to the Hexnode community.
You can disable the VPN icon from the menu bar on macOS devices by executing a custom script through Hexnode UEM. A Bash script to remove the VPN icon from the menu bar is provided below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
#!/bin/sh currentUser=$( echo "show State:/Users/ConsoleUser" | scutil | awk '/Name :/ { print $3 }' ) runAsUser() { currentUserID=$(id -u "$currentUser") if [ "$currentUser" != "loginwindow" ]; then /bin/launchctl asuser "$currentUserID" sudo -u "$currentUser" "$@" fi } runAsUser /usr/libexec/PlistBuddy -c 'delete menuExtras: "/System/Library/CoreServices/Menu Extras/VPN.menu"' /Users/$currentUser/Library/Preferences/com.apple.systemuiserver.plist runAsUser /usr/bin/killall cfprefsd runAsUser /usr/bin/killall SystemUIServer exit 0 |
The above script is adapted from a third-party Open-Source site. Hexnode will not be responsible for any damage/loss to the system on the behavior of the script. As a safety measure, manually validate the script execution on a system before executing the action in bulk.
Hope this helps with your query.
Cheers!
Johan Blake
Hexnode UEM