Category filter
Script to hide Profiles pane from System Preferences on macOS devices
Being the IT administrator of a school or business organization, you might have requirements where you need to hide or disable the Profiles pane from System Preferences on your Mac endpoints. This way, you can prevent users from tampering with the installed profiles and avoid making any configuration errors on the devices. With Hexnode’s Execute Custom Script action, you can remotely hide/disable the Profiles pane on your devices using this bash script.
Scripting language – Bash
File extension – .sh
Script to disable Profiles pane
1 2 |
#!/bin/sh defaults write "/Library/Preferences/com.apple.systempreferences" DisabledPreferencePanes -array "com.apple.preferences.configurationprofiles" |
On running the above script, the Profiles pane will be greyed out from the System Preferences tab on the device.
For example, the following script will disable Bluetooth in addition to the Profiles pane:
1 2 |
#!/bin/sh defaults write "/Library/Preferences/com.apple.systempreferences" DisabledPreferencePanes -array "com.apple.preferences.configurationprofiles" "com.apple.preferences.Bluetooth" |
Script to re-enable a disabled Profiles pane
To re-enable the disabled panes, run the below script on the endpoint devices.
1 2 |
#!/bin/sh defaults delete /Library/Preferences/com.apple.systempreferences DisabledPreferencePanes |
Script to hide Profiles pane
By changing the key from DisabledPreferencePanes to HiddenPreferencePanes, you can configure the Profiles pane to be hidden rather than greyed out.
1 2 |
#!/bin/sh defaults write "/Library/Preferences/com.apple.systempreferences" HiddenPreferencePanes -array "com.apple.preferences.configurationprofiles" |
You can disable/hide any System Preferences pane using this script. All you have to do is identify the correct Bundle identifier for the required pane and include it in the script by following the correct syntax.
Script to unhide Profiles pane
Panes hidden earlier can be selectively revealed by running the Hide Profiles pane script, but with the package names of those panes removed. For instance, consider the script which hides both the Profiles pane and the Bluetooth pane:
1 2 |
#!/bin/sh defaults write "/Library/Preferences/com.apple.systempreferences" HiddenPreferencePanes -array "com.apple.preferences.configurationprofiles" "com.apple.preferences.Bluetooth" |
Now, run the script below to reveal only the hidden Profiles pane.
1 2 |
#!/bin/sh defaults write "/Library/Preferences/com.apple.systempreferences" HiddenPreferencePanes -array "com.apple.preferences.Bluetooth" |
To reveal all hidden panes under System Preferences, run the script provided below.
1 2 |
#!/bin/sh defaults delete /Library/Preferences/com.apple.systempreferences HiddenPreferencePanes |