Change keyboard layout after enrollment once per computer

GalBars
New Contributor

Hello everyone,

I need assistance in configuring a policy that will apply only one time for each new computer following its enrollment, specifically for machines located at a certain site. The policy's aim is to modify the keyboard layout setting.

As it stands, the factory setting for the laptop keyboards is Arabic, and I need to update this to Arabic—PC layout, owing to the fact that most new employees are familiar with the PC keyboard layout. This policy should only affect new installations and not disrupt existing setups. Additionally, I want to ensure that employees retain the option to switch back to the default MacOS keyboard layout if they choose to do so later.

I've investigated the following plist file for keyboard configuration: 

 

 

/Library/Preferences/com.apple.HIToolbox.plist

 

 

However, updating the keyboard layout through system settings does not seem to result in changes to this file.

To modify the file, I've drafted a short bash script:

 

 

#!/bin/bash
USERNAME="$3"

#Actual path

PATH_HIT=~/Library/Preferences/com.apple.HIToolbox.plist

#Contents of plist file ReachAgentConfig.plist
cat > $PATH_HIT << 'ENDSCRIPT'

 

 

 I am seeking guidance on whether this approach will achieve the desired outcome, and I'm open to any suggestions for improvement or alternative methods.

2 REPLIES 2

AJPinto
Honored Contributor III

Im thinking you would just want to use defaults to change the vault of AppleEnabledInputSources in com.apple.HIToolbox.plist.

 

Give this command a try.

defaults write com.apple.HIToolbox AppleSelectedInputSources -array-add '{ "InputSourceKind" = "Keyboard Layout"; "KeyboardLayout ID" = 7; "KeyboardLayout Name" = "Arabic (PC)"; }'

 

As far as scoping and triggering, I would set it to an enrollment only trigger. This will make it run on devices as they enroll and not at any other time, which would leave all your existing devices alone. You can also make a smart group targeting devices enrolled after XYZ date and add this to the scope instead. Then limit the policy to whatever site you want. 

BookMac
Contributor II

we are using this one, if you need it for the login screen also?

https://blog.motionbug.com/posts/filevault-keyboard-fault/