Thursday
We tried this and several other approaches to no avail, are there any currently-working solutions to change the keyboard input language programatically?
#!/bin/bash
# Script to set the default keyboard layout to British
# Set the keyboard layout to British
/usr/bin/defaults write com.apple.HIToolbox AppleCurrentKeyboardLayoutInputSourceID -string "com.apple.keylayout.British"
# Clear the keyboard layout cache
/usr/bin/defaults delete com.apple.HIToolbox AppleEnabledInputSources
# Add the British keyboard layout to the list of enabled input sources
/usr/bin/defaults write com.apple.HIToolbox AppleEnabledInputSources -array-add '<dict><key>InputSourceKind</key><string>Keyboard Layout</string><key>KeyboardLayout ID</key><integer>2</integer><key>KeyboardLayout Name</key><string>British</string></dict>'
# Restart the HIToolbox process to apply changes
/usr/bin/killall -HUP SystemUIServer
echo "Default keyboard layout has been set to British."
Thursday
The default keyboard is something that is set on the user level not the global level. When you run a script as Jamf, it runs the script as root. Basically you are setting the default keyboard for root, try running the script as the user.
Thursday
How do I configure the policy in Jamf to run at user level, don't see any option for this?
yesterday
You don't. Policies all run at the root level as this is where JAMF's binary runs. You can attempt to add user substitution in the script to try to force the commands to run in the user space, but the outcome is not always what you are looking for depending on what exactly you are trying to do.
yesterday
So then how do I "try to run the script as the user" as you suggest?
Thursday
How do I configure the policy in Jamf to run at user level, I don't see any option for that?