Can "defaults write" command line configure the menu bar on macOS?

This defaults write command will enable several menu-bar icons, including Bluetooth.

defaults write com.apple.systemuiserver menuExtras -array \
"/System/Library/CoreServices/Menu Extras/AirPort.menu" \
"/System/Library/CoreServices/Menu Extras/Bluetooth.menu" \
"/System/Library/CoreServices/Menu Extras/Clock.menu" \
"/System/Library/CoreServices/Menu Extras/Displays.menu" \
"/System/Library/CoreServices/Menu Extras/Volume.menu"

Changes will not take effect until you restart the SystemUIServer:
killall SystemUIServer

If you want to enable additional items, look in ~/Library/Preferences/com.apple.systemuiserver.plist to find the specific name of the menu extra you are seeking.

Note: If you attempt to enable a menu extra that you do not have on your machine, the command will get stuck in an endless loop. Some users may not have the Eject.menu, for example.