Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
# Admin-context script to set the administrative language defaults, system locale and install optional features for the primary language
# Language codes
$PrimaryLanguage = "en-GB"
$SecondaryLanguage = "en-US"
$PrimaryInputCode = "0809:00000809"
$SecondaryInputCode = "0409:00000409"
$PrimaryGeoID = "242"
# Enable side-loading
# Required for appx/msix prior to build 18956 (1909 insider)
New-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppModelUnlock -Name AllowAllTrustedApps -Value 1 -PropertyType DWORD -Force
# Provision Local Experience Pack
$BlobURL = ""
$DownloadedFile = "$env:LOCALAPPDATA\"
$WebClient = New-Object System.Net.WebClient
$WebClient.DownloadFile($BlobURL, $DownloadedFile)
Unblock-File -Path $DownloadedFile -ErrorAction SilentlyContinue
Expand-Archive -Path $DownloadedFile -DestinationPath $env:LOCALAPPDATA -Force -ErrorAction Stop
Add-AppxProvisionedPackage -Online -PackagePath "$env:LOCALAPPDATA\en-gb\LanguageExperiencePack.en-gb.Neutral.appx" -LicensePath "$env:LOCALAPPDATA\en-gb\License.xml" -ErrorAction Stop
Remove-Item -Path $DownloadedFile -Force -ErrorAction SilentlyContinue
Write-Host "Failed to install Local Experience Pack: $_"
# Install optional features for primary language
$UKCapabilities = Get-WindowsCapability -Online | Where {$_.Name -match "$PrimaryLanguage" -and $_.State -ne "Installed"}
$UKCapabilities | foreach {
Add-WindowsCapability -Online -Name $_.Name
# Apply custom XML to set administrative language defaults
$XML = @"
<gs:GlobalizationServices xmlns:gs="urn:longhornGlobalizationUnattend">
<!-- user list -->
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/>
<!-- GeoID -->
<gs:GeoID Value="$PrimaryGeoID"/>
<gs:MUILanguage Value="$PrimaryLanguage"/>
<gs:MUIFallback Value="$SecondaryLanguage"/>
<!-- system locale -->
<gs:SystemLocale Name="$PrimaryLanguage"/>
<!-- input preferences -->
<gs:InputLanguageID Action="add" ID="$PrimaryInputCode" Default="true"/>
<gs:InputLanguageID Action="add" ID="$SecondaryInputCode"/>
<!-- user locale -->
<gs:Locale Name="$PrimaryLanguage" SetAsCurrent="true" ResetAllSettings="false"/>
New-Item -Path $env:TEMP -Name "en-GB.xml" -ItemType File -Value $XML -Force
$Process = Start-Process -FilePath Control.exe -ArgumentList "intl.cpl,,/f:""$env:Temp\en-GB.xml""" -NoNewWindow -PassThru -Wait
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment