Setting Language & Timezone of Offline Image Using DISM

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Fugazi666
Posts: 2
Joined: 29 Nov 2017 04:58

Setting Language & Timezone of Offline Image Using DISM

#1 Post by Fugazi666 » 29 Nov 2017 05:34

Code: Select all

 INFO.BAT version 1.4
--------------------------------------------------------------------------------
Windows version        :  Microsoft Windows [Version 10.0.16299.64]
Product name           :  Windows 10 Pro, 64 bit
Performance indicators :  Processor Cores: 8      Visible RAM: 16680436 kilobytes

Date/Time format       :  (dd/mm/yy)  29/11/2017  10:55:30.53
__APPDIR__             :  C:\WINDOWS\System32\
ComSpec                :  C:\WINDOWS\system32\cmd.exe
PathExt                :  .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Extensions             :  system: Enabled   user: Enabled 
Delayed expansion      :  system: Disabled  user: Disabled
Locale name            :  en-GB       Code Pages: OEM  850    ANSI 1252
DIR  format            :  16/11/2017  13:30     2,550,136,832 pagefile.sys
Permissions            :  Elevated Admin=Yes, Admin group=Yes

                          Missing from the tool collection:  debug

Hi,

I have a problem that I hope you guys/gals can help me with.

I have a Windows 10 Pro (64 Bit) captured image in a single WIM file called Install, included in that image are the following installed language packs;

en-GB, en-US, en-AU, en-CA, en-NZ, en-ZA, nl-NL, nl-BE, fr-FR, fr-CA, fr-BE, fr-CH, de-DE, de-CH, it-IT, sv-SE, fi-FI, no-NO, ar-AE, cs-CS, ru-RU, pt-BR, da-DA, hr-HR, bg-BG, ro-RO

The computer system in question is one that is loaned to various people who speak various languages, part of the process is when the system is returned from the loan it is completely wiped (to remove any personal information) and the captured image is deployed using a bespoke batch file run from within WinPE 5.0 .. What I need to do (and have so far failed to accomplish) is to display a list of the available languages (via a .HTA with VBScript code - Ref 1) immediately after booting into the WinPE and then, using DISM change the image to reflect the language selected, my code so far is as follows.

Code: Select all

HTA Code Ref 1

<html>
<head>
<title>Select Windows Language</title>
		<HTA:APPLICATION 
			ID=“LogoDisplay”
			APPLICATIONNAME="Menu"
			SCROLL="no"
			SINGLEINSTANCE="NO"
			MAXIMIZEBUTTON="YES"
			MINIMIZEBUTTON="YES"
			WINDOWSTATE="maximize"
		>
		
<style>
		img {
						width: 45%;
						height: 25%;
					}

		body {
						text-align: center;
						width: 200px;
						margin: 0 auto;
						}
		.btn		{
							background-color:lightblue;
							cursor:pointer;
							height:50px;
							width:400px;
							font-size:1em;
							font-weight:bold;
						}
						
	</style>
		
</head>

<script language="VBScript">

		Option Explicit
		Const ForReading = 1
		dim oFSO, oFile, TEXT, pTXT, objFSO, strLine, strHTML, BCount,pos,trLine,LngSel,objBut,Stxt,LngN
		BCount = 1
				
		sub Window_onload
					Set oFSO=CreateObject("Scripting.FileSystemObject")
					Set oFILE=oFSO.OpenTextFile("HTA.TXT",ForReading)
					TEXT=oFILE.ReadLine
					TEXT=Trim(TEXT)
					'TEXT = "N:"
					document.all.logo.src=TEXT & "\LOGO.JPG"
					oFile.close 
					Set oFSO=Nothing
					Set oFILE=Nothing
					Menu1
		end sub
		
		Sub Menu1
					on error resume next
					pTXT=TEXT & "\languages\languages.ini"
					Set objFSO = CreateObject("Scripting.FileSystemObject")
					Set oFile = objFSO.OpenTextFile(pTXT,ForReading)
					Do Until oFile.AtEndOfStream
							strLine = oFile.ReadLine
							LngN = InStr(strLine,";")
							strLine = Left(strLine,(LngN - 1))
							strHTML = DataArea.InnerHTML
							strHTML = strHTML & "<input id=" & BCount & " type=" & Chr(34) & "button" & Chr(34) & "class=" & Chr(34) & "btn" & Chr(34) & " value= " & Chr(34) & strLine & Chr(34) & " onClick=" & Chr(34) & "MenuSel" & Chr(34) & "style=" & Chr(34) & "margin-right: 5px" & Chr(34) & ">"
							DataArea.InnerHTML = strHTML
							BCount = BCount + 1							
					Loop 
					oFile.Close					
		End Sub	
		
		Sub MenuSel
					Set objBut = window.event.srcelement
					LngN = objBut.Value
					Set objFSO = CreateObject("Scripting.FileSystemObject")
					Stxt=TEXT & "\LANGN.TXT"
					If (objFSO.FileExists(Stxt)) Then objFSO.DeleteFile(Stxt)
					Set oFile = objFSO.CreateTextFile(Stxt,True)
					oFile.Write LngN
					ofile.Close
					self.Close() 
		End Sub

</script>

<body><br>
				<img id="logo" width="900" height="150"><br>
				<strong><br>Select</strong><br><br><br>
				<span id=DataArea></span>	
</body>
</html>
This creates a text file called LANGN.TXT located on the WinPE USB drive that I then read into a variable called L2 in my batch code, L3 contains the relevant Time Zone, as follows;

Code: Select all

REM **  VOL = OS Partition Drive Letter : DDRIVE = Install.wim location : L2 = Selected Windows Language Code eg. en-GB : L3 = Windows Time Zone eg. GMT Standard Time 
MD %VOL%\MOUNT 
DISM /MOUNT-IMAGE /IMAGEFILE:%DDRIVE%\INSTALL.WIM /INDEX:1 /MOUNTDIR:%VOL%\MOUNT
DISM /IMAGE:%VOL%\MOUNT /SET-ALLINTL:%L2% /SET-TIMEZONE:"%L3%"
DISM /UNMOUNT-IMAGE /MOUNTDIR:%VOL%\MOUNT /COMMIT
RD %VOL%\MOUNT /Q /S
This appears to work, there are no errors with SET-ALLINTL or SET-TIMEZONE, and the deployment completes .. Windows boots into the selected language .. however, all the menus etc are still in UK English and the other installed languages are no longer displayed on the language bar (though running a command prompt DISM /ONLINE /GET-INTL shows all the languages are still installed)

I've done a huge amount of searching and have been unable to find a way to basically mimic the GUI 'Apply language settings to the welcome screen, system accounts and new user accounts' or 'make this the primary language' using a batch program file.

Hoping you can help and what I am looking for isn't to confusing.

Fug666

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Setting Language & Timezone of Offline Image Using DISM

#2 Post by aGerman » 29 Nov 2017 11:09

Neither do I have any experiences nor would I be able to test it. I only found the manpage for Languages and International Servicing which shows some additional options were we don't know if you already tried them.
https://docs.microsoft.com/en-us/window ... ne-options

Steffen

Fugazi666
Posts: 2
Joined: 29 Nov 2017 04:58

Re: Setting Language & Timezone of Offline Image Using DISM

#3 Post by Fugazi666 » 29 Nov 2017 11:13

Hi, Yes I've gone through each of those settings and none of them will achieve what I require, but thank you for responding.

I am getting the feeling that this is going to involve loading registry hives and making changes.

Fug

Post Reply