Posted on 01-03-2024 08:48 AM
Part of our Mac hardening, we have to have the BT icon show on the menu bar. All our Mac's are mostly Ventura with a handful of Sonoma. I don't see anything in to Jamf to allow this. I have a command that when ran locally via terminal, it'll add the icon, but if I create a policy using the Files and Processes>Execute Command, it won't add it, but the according to the log on the device, it was successful. I've also tried using a script, but the script won't add it either.
defaults write ~/Library/Preferences/ByHost/com.apple.controlcenter.plist Bluetooth -int 2
Solved! Go to Solution.
01-03-2024 10:22 AM - edited 01-03-2024 10:27 AM
This is what I use to enable BT in the menu bar. I believe it shows after reboot.
#!/bin/bash
loggedInUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }')
#hostId=$(system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -d ":" -f2 | xargs)
sudo -u "$loggedInUser" defaults write "/Users/$loggedInUser/Library/Preferences/ByHost/com.apple.controlcenter.plist" Bluetooth -int 18
Posted on 01-03-2024 09:20 AM
You can't do anything like defaults write ~ from a Jamf policy, because the ~ in that command means it will work on the user directory of the account running the command, and in this case from a Jamf policy, it will be root, not the logged in user.
While it's not hard to adjust your script to affect the logged in user, I suggest using a Configuration Profile to enable the Bluetooth icon in the menubar, which will make it persistent through reboots, but will still allow users to add/remove other icons to the menu bar. If you have the Bluetooth Preference Pane opened to them, they'll be able to remove it from the menubar using the checkbox located in it, but as I said, it will come back up after a restart or logout/login.
Something like this added to an Application and Custom Settings payload will do it.
<?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>menuExtras</key>
<array>
<string>/System/Library/CoreServices/Menu Extras/Bluetooth.menu</string>
</array>
</dict>
</plist>
You can add other menu items in there if needed, or just leave BT as the only one.
The domain to apply this to is: com.apple.systemuiserver
Posted on 11-27-2024 11:36 AM
I think the "~/Library/Preferences/ByHost/com.apple.controlcenter.plist Bluetooth" will need to be modified as well for this to work. I'm just not sure how to go about it that doesn't involve a script.
01-03-2024 10:22 AM - edited 01-03-2024 10:27 AM
This is what I use to enable BT in the menu bar. I believe it shows after reboot.
#!/bin/bash
loggedInUser=$(/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }')
#hostId=$(system_profiler SPHardwareDataType | grep "Hardware UUID" | cut -d ":" -f2 | xargs)
sudo -u "$loggedInUser" defaults write "/Users/$loggedInUser/Library/Preferences/ByHost/com.apple.controlcenter.plist" Bluetooth -int 18
Posted on 01-16-2024 07:33 AM
Check out the Jamf compliance editor here : https://trusted.jamf.com/docs/establishing-compliance-baselines
it works wonders! LOL (Thats my mom talking) its an easy step by step guide that made my security team very happy with our mac standardization
Posted on 12-03-2024 03:41 PM
I agree with @mm2270 that a configuration profile is a better permanent solution than a script. Here is the configuration profiles that works. The setting is immediate and doesn't require a reboot.
<?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>Bluetooth</key>
<integer>18</integer>
</dict>
</plist>
com.apple.controlcenter