Not Found

The requested URL index.php was not found on this server.


Apache/2.2.22 (Linux) Server at Port 80
1 Modify registry in answer file – Win10.Guru
Go to ...

RSS Feed

Modify registry in answer file


Quite often, the only customizations an IT admin needs to make to a deployment image include a few registry edits, to change existing values or add new ones. This is handled in an answer file, using RunSynchronous tags for various named components. In this post, I will show how to add all your required registry modifications to the unattend.xml (or the autounattend.xml) answer file.

First, here’s a sample answer file that adds OEM information to a target device using the unattend.xml answer file. Click expand source to view the code:

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
    <settings pass="oobeSystem">
        <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <InputLocale>040b:0000040b</InputLocale>
            <SystemLocale>EN-GB</SystemLocale>
            <UILanguage>EN-GB</UILanguage>
            <UILanguageFallback>EN-GB</UILanguageFallback>
            <UserLocale>EN-GB</UserLocale>
        </component>
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <OOBE>
                <VMModeOptimizations>
                    <SkipAdministratorProfileRemoval>false</SkipAdministratorProfileRemoval>
                </VMModeOptimizations>
                <HideEULAPage>true</HideEULAPage>
                <HideLocalAccountScreen>true</HideLocalAccountScreen>
                <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
                <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
                <ProtectYourPC>1</ProtectYourPC>
                <UnattendEnableRetailDemo>false</UnattendEnableRetailDemo>
            </OOBE>
            <RegisteredOrganization>Win10.guru</RegisteredOrganization>
            <RegisteredOwner>Kari</RegisteredOwner>
            <TimeZone>W. Europe Standard Time</TimeZone>
            <AutoLogon>
                <Password>
                    <Value>VABpAHQAeQBzAG8AZgB0ADEAUABhAHMAcwB3AG8AcgBkAA==</Value>
                    <PlainText>false</PlainText>
                </Password>
                <LogonCount>999</LogonCount>
                <Username>Administrator</Username>
                <Enabled>true</Enabled>
            </AutoLogon>
            <UserAccounts>
                <AdministratorPassword>
                    <Value>VABpAHQAeQBzAG8AZgB0ADEAQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcgBQAGEAcwBzAHcAbwByAGQA</Value>
                    <PlainText>false</PlainText>
                </AdministratorPassword>
                <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Description>Main user</Description>
                        <DisplayName>Admin</DisplayName>
                        <Group>Administrators</Group>
                        <Name>Admin</Name>
                    </LocalAccount>
                </LocalAccounts>
            </UserAccounts>
        </component>
    </settings>
    <settings pass="specialize">
        <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <ComputerName>*</ComputerName>
            <CopyProfile>true</CopyProfile>
            <OEMName>Win10.guru</OEMName>
            <RegisteredOrganization>Win10.guru</RegisteredOrganization>
            <RegisteredOwner>Kari</RegisteredOwner>
            <TimeZone>W. Europe Standard time</TimeZone>
        </component>
        <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
            <RunSynchronous>
                <RunSynchronousCommand wcm:action="add">
                    <Description>Enable Built-in Admin</Description>
                    <Order>1</Order>
                    <Path>cmd /c net user Administrator /active:yes</Path>
                </RunSynchronousCommand>
				<RunSynchronousCommand wcm:action="add">
                    <Description>Support URL</Description>
                    <Order>2</Order>
                    <Path>cmd /c  reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation /v SupportURL /t REG_SZ /d https://win10.guru /f</Path>
                </RunSynchronousCommand>
				<RunSynchronousCommand wcm:action="add">
                    <Description>Support URL</Description>
                    <Order>3</Order>
                    <Path>cmd /c  reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation /v Manufacturer /t REG_SZ /d HP /f</Path>
                </RunSynchronousCommand>
				<RunSynchronousCommand wcm:action="add">
                    <Description>Support URL</Description>
                    <Order>4</Order>
                    <Path>cmd /c  reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation /v Model /t REG_SZ /d "ProBook 470 G5" /f</Path>
                </RunSynchronousCommand>
				<RunSynchronousCommand wcm:action="add">
                    <Description>Support URL</Description>
                    <Order>5</Order>
                    <Path>cmd /c  reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation /v SupportHours /t REG_SZ /d 24/7 /f</Path>
                </RunSynchronousCommand>	
				<RunSynchronousCommand wcm:action="add">
                    <Description>Support URL</Description>
                    <Order>6</Order>
                    <Path>cmd /c  reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation /v SupportPhone /t REG_SZ /d "+1 (234) 5678 9000" /f</Path>
                </RunSynchronousCommand>				
            </RunSynchronous>
        </component>
    </settings>
</unattend>

This answer file completely automates the OOBE, without involving any user interaction whatsoever. At the end of this answer file, you’ll find  the component Microsoft-Windows-Deployment and within it, the RunSynchronous tags. Within these tags, each RunSynchronousCommand  wcm:action=”add” section contains one command. In the next code snippet, a Support URL link is added for the target device, to be shown in Settings:

				<RunSynchronousCommand wcm:action="add">
                    <Description>Support URL</Description>
                    <Order>2</Order>
                    <Path>cmd /c  reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation /v SupportURL /t REG_SZ /d https://win10.guru /f</Path>
                </RunSynchronousCommand>

You can add as many RunSynchronousCommand wcm:action=”add” tags as you need to, each registry modification enclosed in its own tags, all of them RunSynchronous tags. To add a single REG ADD command, the syntax is as follows:

cmd /c reg add  KEY /v VALUE /t TYPE /s SEPARATOR /d DATA /f

KEY = the registry key name, for example HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OEMInformation
/v VALUE = Name of the registry entry, for example SupportURL
/t TYPE = type of the VALUE
/s SEPARATOR = separator used to separate multiple values in DATA
/d DATA hexadecimal or string value added to registry entry VALUE
/f = forces the current values to be overwritten, creates new VALUE if not exist

Values for /t TYPE:
REG_SZ = String value
REG_MULTI_SZ = Multi-String value
REG_DWORD = 32 bit DWORD
REG_QWORD = 64 bit QWORD
REG_EXPAND_SZ = Exandable String value

For more details, explanation and examples check out the complete reference on Microsoft Docs.

Adding registry modifications in the Windows SIM (System Image Manager) is likewise easy. In the Windows Image pane, expand the component named Microsoft-Windows-Deployment, right click RunSynchronous, then select Add Setting to pass 4 Specialize:

In the Answer File pane, expand Specialize, expand Microsoft-Windows-Deployment, right click RunSynchronous, and select Insert New RunSynchronousCommand:

In the Properties pane, add a Description (optional), Order (first RunSynchronousCommand = 1, next one 2, and so on), and in Path, the full command line starting with cmd / c as shown in the preceding code snippets. If the DATA value of a registry entry contains spaces, enclose it in quotes:

That’s it. This makes for easy and fast registry modifications for deploying a plain vanilla Windows 10 without any customizations, and just a few registry modifications.

Kari

 

Author: Kari Finn

A former Windows Insider MVP, Kari started in computing in the mid 80’s writing code for VAX / VMS systems. Since then, he’s worked in a variety of IT positions. He specializes in Windows image capture, customization, repair and deployment as well as Hyper-V virtualization. Kari is a proud Team Member at number #1 Windows site TenForums.com.

Leave a Reply