# https://setkeyboard.bezirk.osdcloud.ch $Global:Transcript = "$((Get-Date).ToString('yyyy-MM-dd-HHmmss'))-Change-KeyboardLanguage.log" Start-Transcript -Path (Join-Path "$env:ProgramData\Microsoft\IntuneManagementExtension\Logs\OSD\" $Global:Transcript) -ErrorAction Ignore Write-Host "Change default user settings" -ForegroundColor Cyan $registryPath = "Registry::HKEY_USERS\.DEFAULT" Write-Host "Cleanup all preload entries" $properties = Get-ItemProperty -Path "$registryPath\Keyboard Layout\Preload" $values = @("1","2","3") $values | ForEach-Object { if ($properties.PSObject.properties.Match($_)) { Write-Host "Value '$_' still exists --> remove it" try { Remove-ItemProperty -Path "$registryPath\Keyboard Layout\Preload" -Name "$_" -Force -ErrorAction Stop Write-Host "Value '$_' removed successfully" } catch { Write-Host "Failed to remove value '$_': $_" -ForegroundColor Red } } } Write-Host "Create the preload registry key" -ForegroundColor Yellow $valueName = "1" $newValue = "00000807" try { New-ItemProperty -Path "$registryPath\Keyboard Layout\Preload" -Name $valueName -Value $newValue -ErrorAction Stop Write-Host "Preload registry key created successfully" } catch { Write-Host "Failed to create preload registry key: $_" -ForegroundColor Red } Write-Host "Clean user profile if needed" -ForegroundColor Yellow If (Get-Item -Path "$registryPath\Control Panel\International\User Profile\de-DE" -ErrorAction SilentlyContinue) { try { Remove-Item "$registryPath\Control Panel\International\User Profile\de-DE" -Force -ErrorAction Stop Write-Host "User profile cleaned successfully" } catch { Write-Host "Failed to clean user profile: $_" -ForegroundColor Red } } Write-Host "Clean user profile system backup if needed" -ForegroundColor Yellow If (Get-Item -Path "$registryPath\Control Panel\International\User Profile System Backup\de-DE") { try { Remove-Item "$registryPath\Control Panel\International\User Profile System Backup\de-DE" -Force -ErrorAction Stop Write-Host "User profile system backup cleaned successfully" } catch { Write-Host "Failed to clean user profile system backup: $_" -ForegroundColor Red } } Stop-Transcript