Windows Server

An error has occurred in the script on this page: HTA applications report a Script error after upgrading to ADK for Windows 11, version 22H2


Microsoft Deployment Toolkit (MDT) is a unified collection of tools, processes, and guidance for automating desktop and server deployment. And this in turn reduces deployment time and standardizes desktop and server image deployment. MDT builds on top of the core deployment tools in the Windows Assessment and Deployment Kit (Windows ADK). Its additional guidance and features are designed to reduce the complexity and time required for deployment in an enterprise environment. Here are some interesting guides: How to correctly upgrade Windows Assessment and Deployment Kit, Windows Preparation Environment, and Microsoft Deployment Toolkit,  How to Add Packages to Windows image the DISM Tool, and how to add languages to Windows image using DISM and PowerShell.

What is the reason for this error?

After you updated your MDT boot image to ADK for Windows 11, version 22H2, HTA applications stop working and a message box is displayed: Script Error – An error has occurred in the script on this page. In this guide, I will be providing you with the steps to fix this issue and its limitations with the Microsoft Deployment Toolkit (MDT). You may want to read this blog post “Install ADK, MDT, and WDS: How to deploy Windows images via Microsoft Deployment Toolkit and Windows Deployment Services“.

An HTML Application (HTA) is a Microsoft Windows program whose source code consists of HTML, Dynamic HTML, and one or more scripting languages, such as VBScript or JScript. The “HTML” is used to generate the user interface, and the scripting language is used for the program logic. An HTA executes without the constraints of the internet browser security model; in fact, it executes as a “fully trusted” application.

HTA applications rely on MSHTML and starting with Windows 11, version 22H2, the default legacy scripting engine was changed. To work around this issue you need to add the following registry value in WinPE:

reg.exe add "HKLM\Software\Microsoft\Internet Explorer\Main" /t REG_DWORD /v JscriptReplacement /d 0 /f

What is Windows PE (WinPE)?

Windows PE (WinPE) is a small operating system used to install, deploy, and repair Windows desktop editions, Windows Server, and other Windows operating systems.

Implement this change in MDT to solve the issue

To enable this change in MDT, we recommend that you back up the following file and modify it as follows: 

C:\Program Files\Microsoft Deployment Toolkit\Templates\Unattend_PE_x64.xml

All you have to do is to modify it as follows below. Do not forget to back up the following file before modifying it.

<unattend xmlns="urn:schemas-microsoft-com:unattend">
   <settings pass="windowsPE">
       <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="">
               <RunSynchronousCommand wcm:action="add">
                   <Description>Lite Touch PE</Description>
                   <Path>reg.exe add "HKLM\Software\Microsoft\Internet Explorer\Main" /t REG_DWORD /v JscriptReplacement /d 0 /f</Path>
               <RunSynchronousCommand wcm:action="add">
                   <Description>Lite Touch PE</Description>
                   <Path>wscript.exe X:\Deploy\Scripts\LiteTouch.wsf</Path>

Note: After saving the changes, you will need to completely regenerate the boot images. To do this, right-click on the deployment share and select Update Deployment Share.


As you can see, the Deployment Share Update is in progress as shown below.


The Deployment Update is complete. You can now take the (LiteTouchWinPE.wim) image to the Server and start a new Windows Deployment without further issues.


I hope you found this blog post helpful. Please let me know in the comment session if you have any questions.

Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x