SE の雑記

SQL Server の情報をメインに Microsoft 製品の勉強内容を日々投稿

Azure 上の Windows Server 2016 TP5 をスクリプトベースで日本語化してみる

leave a comment

山市さんが、TP5 on Azure を今すぐ日本語化する (MSDN サブスクライバー限定)  で公開してくださっていますが、Azure 上の TP5 を日本語化する作業をいくつかこなさなければいけなかったので、スクリプト化してみました。

以前投稿した、Azure VM の日本語 UI を PowerShell で設定  とほぼ同じですが、TP5 の言語パックがインターネット経由でダウンロードできないため、MSDN の言語バックのメディアの日本語の言語パックを Azure ストレージに配置して使っています。

粗々ですが、作成したのがこちら。
パブリックなアクセスレベルではなく、ファイルに対して SAS を設定してファイルのダウンロードを実施しています。

$lpurl = "https://<ストレージアカウント>.blob.core.windows.net/modules"
$lpfile = "x64fre_Server_ja-jp_lp.cab"
$sas = "<sas トークン>"
$wintemp = "C:\Windows\Temp"
$RunOncePath = "registry::\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
$AutoLogonPath = "registry::\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
$AdminUser = "<管理者ユーザー名>"
$adminpassword = "<パスワード>"
$runonce = @"
Set-WinUILanguageOverride ja-JP
Set-WinSystemLocale 1041
Set-WinHomeLocation 0x7A
tzutil /s "Tokyo Standard Time"
Set-ItemProperty -Path "$AutoLogonPath" -Name "AutoAdminLogon" -Value "0"
Remove-ItemProperty -Path "$AutoLogonPath" -Name "DefaultUserName"
Remove-ItemProperty -Path "$AutoLogonPath" -Name "DefaultPassword"
restart-computer
"@
Set-WinUserLanguageList ja-jp,en-US -Force
Invoke-WebRequest -Uri "$($lpurl)/$($lpfile)$($sas)" -OutFile "$($wintemp)\$($lpfile)"
Add-WindowsPackage -Online -PackagePath "$($wintemp)\$($lpfile)"
$runonce | Out-File -FilePath C:\Windows\Temp\SetupLang.ps1 -Encoding ascii
Set-ItemProperty -Path $RunOncePath -Name "SetupLang" -Value "powershell.exe -ExecutionPolicy RemoteSigned -file C:\Windows\Temp\SetupLang.ps1"
Set-ItemProperty -Path $AutoLogonPath -Name "AutoAdminLogon" -Value "1"
Set-ItemProperty -Path $AutoLogonPath -Name "DefaultUserName" -Value $AdminUser
Set-ItemProperty -Path $AutoLogonPath -Name "DefaultPassword" -Value $adminpassword
restart-computer

.NET Framework 3.5 についても、OS のインストールメディアの sxs からファイルをコピーすれば、似たような仕組みでインストールできるかと。

$wintemp = "C:\Windows\Temp"
$dotneturl = "https://<ストレージアカウント名>.blob.core.windows.net/modules"
$dotnetfile = "microsoft-windows-netfx3-ondemand-package.cab"
$sas = "<sas トークン>"
Invoke-WebRequest -Uri "$($dotneturl)/$($dotnetfile)$($sas)" -OutFile "$($wintemp)\$($dotnetfile)"
Install-WindowsFeature -Name NET-Framework-Features -Source "$($wintemp)"
Share

Written by Masayuki.Ozawa

5月 8th, 2016 at 12:47 pm

Posted in Microsoft Azure

Tagged with

Leave a Reply