Created
March 27, 2020 18:05
-
-
Save SMSAgentSoftware/cbc1f448b9f3ff4ed7b5ced54d52cab0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 = "https://mystorageaccount.blob.core.windows.net/mycontainer/en-gb.zip?sp=r&st=2020-03-26T18:02:28Z&se=2050-03-27T00:02:28Z&spr=https&sv=2019-02-02&sr=b&sig=91234567890OYr%2BI0RcryhGFy1DNMlzhfIWbQ%3D" | |
$DownloadedFile = "$env:LOCALAPPDATA\en-GB.zip" | |
Try | |
{ | |
$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 | |
} | |
Catch | |
{ | |
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:UserList> | |
<gs:User UserID="Current" CopySettingsToDefaultUserAcct="true" CopySettingsToSystemAcct="true"/> | |
</gs:UserList> | |
<!-- GeoID --> | |
<gs:LocationPreferences> | |
<gs:GeoID Value="$PrimaryGeoID"/> | |
</gs:LocationPreferences> | |
<gs:MUILanguagePreferences> | |
<gs:MUILanguage Value="$PrimaryLanguage"/> | |
<gs:MUIFallback Value="$SecondaryLanguage"/> | |
</gs:MUILanguagePreferences> | |
<!-- system locale --> | |
<gs:SystemLocale Name="$PrimaryLanguage"/> | |
<!-- input preferences --> | |
<gs:InputPreferences> | |
<gs:InputLanguageID Action="add" ID="$PrimaryInputCode" Default="true"/> | |
<gs:InputLanguageID Action="add" ID="$SecondaryInputCode"/> | |
</gs:InputPreferences> | |
<!-- user locale --> | |
<gs:UserLocale> | |
<gs:Locale Name="$PrimaryLanguage" SetAsCurrent="true" ResetAllSettings="false"/> | |
</gs:UserLocale> | |
</gs:GlobalizationServices> | |
"@ | |
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 | |
$Process.ExitCode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment