Our Student Users don’t have admin rights. So it was necessary to adapt the [UsedPrinterName].ppd file. And set the Value from DefaultAPOptionalDuplexer: False to True.
magic:
sed -i '' 's/*search_string/*replace_string/g' /path/to/file.extension
“-i ”” edit the changes into the same file (there is a blank between -i and the double empty quote!
############ change duplex
Printer_X=$(less /private/etc/cups/ppd/Printer_X.ppd | grep "*DefaultAPOptionalDuplexer: False")
if [ "$Printer_X" == "*DefaultAPOptionalDuplexer: False" ]
then
echo "change Printer_X to duplex"
sed -i '' 's/*DefaultAPOptionalDuplexer: False/*DefaultAPOptionalDuplexer: True/g' /private/etc/cups/ppd/Printer_X.ppd
else
echo "not needed"
fi
############
...
## check if emoji and keyboard setting activ
SYSUI=$(defaults read /Users/student/Library/Preferences/com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.textinput">&1)
if [ "$SYSUI" == "1" ]
then
echo "setting existing..."
else
# emoji & keyboard & keyboard layout Austria
defaults write /Users/student/Library/Preferences/com.apple.HIToolbox AppleEnabledInputSources -array-add '<dict><key>Bundle ID</key><string>com.apple.CharacterPaletteIM</string><key>InputSourceKind</key><string>Non Keyboard Input Method</string></dict>'
defaults write /Users/student/Library/Preferences/com.apple.HIToolbox AppleEnabledInputSources -array-add '<dict><key>Bundle ID</key><string>com.apple.KeyboardViewer</string><key>InputSourceKind</key><string>Non Keyboard Input Method</string></dict>'
defaults write /Users/student/Library/Preferences/com.apple.HIToolbox AppleEnabledInputSources -array-add '<dict><key>InputSourceKind</key><string>Keyboard Layout</string><key>KeyboardLayout ID</key><integer>92</integer><key>KeyboardLayout Name</key><string>Austrian</string></dict>'
defaults write /Users/student/Library/Preferences/com.apple.systemuiserver "NSStatusItem Visible com.apple.menuextra.textinput" -bool TRUE
defaults write /Users/student/Library/Preferences/com.apple.systemuiserver menuExtras -array-add "/System/Library/CoreServices/Menu Extras/TextInput.menu"
chown ws /Users/student/Library/Preferences/com.apple.systemuiserver.plist
chgrp staff /Users/student/Library/Preferences/com.apple.systemuiserver.plist
chown ws /Users/student/Library/Preferences/com.apple.HIToolbox.plist
chgrp staff /Users/student/Library/Preferences/com.apple.HIToolbox.plist
killall -KILL cfprefsd
killall -KILL SystemUIServer
fi
...
Tested on MacOS 10.14.5 / 10.14.6
I use this within a login script triggered with Jamf (Loginhook). This was the only working solution I have found to enable in school lab environment.

#!/bin/bash
CURRENTUSER=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
su "$CURRENTUSER" -c "defaults write /Users/ws/Library/Preferences/.GlobalPreferences AppleShowAllExtensions -bool true"
su "$CURRENTUSER" -c "killall Finder"
Tested on MacOS 10.14.5 / 10.14.6
is better than no research