Skip to content

Instantly share code, notes, and snippets.

@hiryamada
Created December 28, 2022 10:01
Show Gist options
  • Select an option

  • Save hiryamada/7a3ce9ee7b364cab8c2171e6e20ff90c to your computer and use it in GitHub Desktop.

Select an option

Save hiryamada/7a3ce9ee7b364cab8c2171e6e20ff90c to your computer and use it in GitHub Desktop.
# 参考: https://bonjiri-blog.com/other/windows/change-lang-use-powershell/#toc6
# Windows Server 2022用の"言語とオプション機能の ISO" のダウンロード
# https://www.microsoft.com/ja-jp/evalcenter/evaluate-windows-server-2022
$uri = 'https://go.microsoft.com/fwlink/p/?linkid=2195333'
$outpath = 'c:\langpack.iso'
# Invoke-WebRequest の代わりに net.webclientを使用してダウンロードを高速化
# https://stackoverflow.com/questions/28682642/powershell-why-is-using-invoke-webrequest-much-slower-than-a-browser-download
$wc = New-Object net.webclient
$wc.Downloadfile($uri, $outpath)
echo 'language pack downloaded'
# ISOに含まれる言語パックを自動インストール
$MountImage = Mount-DiskImage $outpath
$DriveLetter = ($MountImage | Get-Volume).DriveLetter
$LanguagePack_Path = $DriveLetter + ":\LanguagesAndOptionalFeatures\Microsoft-Windows-Server-Language-Pack_x64_ja-jp.cab"
# /i: インストールする言語
# /r: 再起動しない
# /p: 言語パックのパス
# /s: 無人インストール(GUIを表示しない)
C:\windows\system32\Lpksetup.exe /i ja-JP /r /p $LanguagePack_Path /s
# lpksetupプロセスが終了するまで待つ
# https://infralalala.com/archive/405/
Start-sleep -second 5
Wait-Process -Name lpksetup
echo 'language pack installed'
# UIの言語等を日本語に設定
Set-TimeZone -Id "Tokyo Standard Time"
Set-WinUserLanguageList -LanguageList ja-JP,en-US -Force
Set-WinHomeLocation -GeoId 0x7A
Set-WinSystemLocale -SystemLocale ja-JP
Set-WinUILanguageOverride -Language ja-JP
echo 'language settings updated'
# 再起動
echo 'restart'
Restart-Computer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment