(208) Microsoft Intune - Setting 'Grave accent' to switch Language Input
- Mr B SOE way
- May 1
- 2 min read
Been working with a greenfield customer who I have been helping over the last few months, and of late they wanted to implement 'Grave Accent' with 'Thai Kedmanee'.
Keyboard: "Thai Kedmanee"
Advanced Key Setting:
- To turn off Caps Lock: "Press the CAPS LOCK key"
- Hot keys for input languages: Action: "Between input languages", Key sequence: "Grave Accent"
As the current build deploys en-US as the default language for their user driven and self-deployment builds which is covered in my blog here to use a win32 app.
The only way to get this working is to deploy as a 'PowerShell' script with the following:
As the default language is en-US, we are not going to mess up the win32 app as that works fine. As we want to add in "Thai Kedmanee" which is th-TH, we will need add it to the script to install that language pack.
In the script, it does show - this will still honor the required settings
Set-Culture -CultureInfo en-US
Set-WinSystemLocale -SystemLocale en-US
Set-WinHomeLocation -GeoId 227 #Thailand
Set-WinUILanguageOverride -Language en-USWe will use HKCU to deploy and enable these settings from 3. to 5. where 6.
# 1. Error Handling & Execution Context
$ErrorActionPreference = "Stop"
# Function to check for Admin rights (needed for Language Installation)
function Test-IsAdmin {
$currentPrincipal = New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())
return $currentPrincipal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
}
# 2. System-Level Settings (Must be Admin)
if (Test-IsAdmin) {
try {
# Check if language is already installed to avoid unnecessary overhead
if (!(Get-InstalledLanguage | Where-Object { $_.LanguageId -eq "th-TH" })) {
Install-Language th-TH -ErrorAction SilentlyContinue
}
Set-Culture -CultureInfo en-US
Set-WinSystemLocale -SystemLocale en-US
Set-WinHomeLocation -GeoId 227
Set-WinUILanguageOverride -Language en-US
} catch {
Write-Warning "System-level settings failed: $_"
}
}
# 3. User-Level Configuration
# Logic: We use -ErrorAction SilentlyContinue for registry creation to prevent "already exists" stops
try {
# Ensure Registry paths exist
$Paths = @(
"HKCU:\Keyboard Layout",
"HKCU:\Keyboard Layout\Toggle",
"HKCU:\Control Panel\Input Method\Hot Keys\00000070"
)
foreach ($Path in $Paths) {
if (!(Test-Path $Path)) {
New-Item -Path $Path -Force | Out-Null
}
}
# Define and Apply Language List
$LanguageList = New-WinUserLanguageList -Language "en-US"
$LanguageList.Add("th-TH")
Set-WinUserLanguageList -LanguageList $LanguageList -Force -Confirm:$false
# 4. Input Switching Hotkey (Grave Accent / Tilde)
$HotkeyPath = "HKCU:\Control Panel\Input Method\Hot Keys\00000070"
$TogglePath = "HKCU:\Keyboard Layout\Toggle"
# Use 'Set-ItemProperty' carefully. Force ensures overwrite.
Set-ItemProperty -Path $HotkeyPath -Name 'Key Modifiers' -Value ([byte[]](0x00,0x00,0x00,0x00)) -Type Binary -Force
Set-ItemProperty -Path $HotkeyPath -Name 'Virtual Key' -Value ([byte[]](0xc0,0x00,0x00,0x00)) -Type Binary -Force
Set-ItemProperty -Path $TogglePath -Name 'Language Hotkey' -Value '4' -Type String -Force
Set-ItemProperty -Path $TogglePath -Name 'Layout Hotkey' -Value '4' -Type String -Force
Set-ItemProperty -Path $TogglePath -Name "Hotkey" -Value "3" -Type String -Force
# 5. Caps Lock Behavior
Set-ItemProperty -Path "HKCU:\Keyboard Layout" -Name "Attributes" -Value 0 -Type DWord -Force
} catch {
Write-Warning "User-level settings failed: $_"
}
# 6. Final Sync
if (Test-IsAdmin) {
try {
# Note: This may fail if no user session is active or in certain OOBE states
Copy-UserInternationalSettingsToSystem -WelcomeScreen $True -NewUser $True -ErrorAction SilentlyContinue
} catch {
Write-Host "Copy-UserInternationalSettings skipped or failed."
}
}Run this script using the logged on credentials = No
Enforce script signature check = No
Run script in 64 bit PowerShell Host = Yes
Once the device has received the script, it will deploy and set this.






Comments