Windows 10 SysPrep: How to enter hostname and skip entering product key

15,201
  1. I had the same issue recently and the following is my working solution:
    <?xml version="1.0" encoding="utf-8"?>
    <unattend xmlns="urn:schemas-microsoft-com:unattend">
      <settings pass="windowsPE">
        <component name="Microsoft-Windows-International-Core-WinPE" 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">
          <SetupUILanguage>
            <UILanguage>en-US</UILanguage>
          </SetupUILanguage>
          <InputLocale>0c09:00000409</InputLocale>
          <SystemLocale>en-US</SystemLocale>
          <UILanguage>en-US</UILanguage>
          <UILanguageFallback>en-US</UILanguageFallback>
          <UserLocale>en-US</UserLocale>
        </component>
        <component name="Microsoft-Windows-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">
          <UserData>
            <AcceptEula>true</AcceptEula>
            <FullName></FullName>
            <Organization></Organization>
            <ProductKey>
            <Key></Key>
            <WillShowUI>Never</WillShowUI>
            </ProductKey>
          </UserData>
          <DynamicUpdate>
            <Enable>false</Enable>
            <WillShowUI>Never</WillShowUI>
          </DynamicUpdate>
          <EnableFirewall>false</EnableFirewall>
          <LogPath>C:\Log</LogPath>
        </component>
      </settings>
      <settings pass="offlineServicing">
        <component name="Microsoft-Windows-LUA-Settings" 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">
          <EnableLUA>false</EnableLUA>
        </component>
      </settings>
      <settings pass="generalize">
        <component name="Microsoft-Windows-Security-SPP" 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">
          <SkipRearm>1</SkipRearm>
        </component>
      </settings>
      <settings pass="specialize">
        <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>0409:00000409</InputLocale>
          <SystemLocale>en-US</SystemLocale>
          <UILanguage>en-US</UILanguage>
          <UILanguageFallback>en-US</UILanguageFallback>
          <UserLocale>en-US</UserLocale>
        </component>
        <component name="Microsoft-Windows-Security-SPP-UX" 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">
          <SkipAutoActivation>true</SkipAutoActivation>
        </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">
          <ComputerName>PC_NAME</ComputerName>
        </component>
      </settings>
      <settings pass="oobeSystem">
        <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">
          <UserAccounts>
            <AdministratorPassword>
              <Value>PasswordHERE</Value>
              <PlainText>true</PlainText>
            </AdministratorPassword>
          </UserAccounts>
          <AutoLogon>
            <Password>
              <Value>PasswordHERE</Value>
              <PlainText>true</PlainText>
            </Password>
            <Username>Administrator</Username>
            <LogonCount>99</LogonCount>
            <Enabled>true</Enabled>
          </AutoLogon>
          <OOBE>
            <HideEULAPage>true</HideEULAPage>
            <HideLocalAccountScreen>true</HideLocalAccountScreen>
            <HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
            <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
            <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
            <NetworkLocation>Work</NetworkLocation>
            <ProtectYourPC>3</ProtectYourPC>
            <SkipMachineOOBE>true</SkipMachineOOBE>
            <SkipUserOOBE>true</SkipUserOOBE>
          </OOBE>
          <TimeZone>Central European Standard Time</TimeZone>
        </component>
      </settings>
      <cpi:offlineImage cpi:source="" xmlns:cpi="urn:schemas-microsoft-com:cpi" />
    </unattend>
    
  2. I handle it differently with the creation of VM, replacing the hostname [PC_NAME] in the Powershell script with the expected value, given as a parameter.
Share:
15,201

Related videos on Youtube

amm
Author by

amm

Updated on September 18, 2022

Comments

  • amm
    amm over 1 year

    During the post-SysPreped boot, I need to configure an unattend.xml file to:

    1. Not ask for the Windows product key, leaving the product key blank. The only way I've found to do this is by configuring the OOBE pass value SkipMachineOOBE as true:
      • oobeSystem - microsoft-windows-shell-setup_neutral - OOBE - SkipMachineOOBE
      • WSIM online help clearly states this is an obsolete option that shouldn't be used with Windows 10, as it will conflict with other options.
    2. Ask for the hostname in the format PC1234
      • PC is a constant and it would be great to hardcode it, only needing to enter the numbers 1234, 2345, etc., however I'm not sure how to do this within an unattend.xml file.

    Is there an unattended option for this I'm missing?

    • Ramhound
      Ramhound about 8 years
      I want to make sure I understand what you want. You want the unattend.xml, to handle inputing the product key, is that correct?
    • amm
      amm about 8 years
      Want the unattend .xml file to command the sysprep process to skip/omit etc. the product key. That will be taken care later. I need to not enter a product key in sysprep.
    • amm
      amm about 8 years
      want to skip this screen [jpg link ->] zdnet1.cbsistatic.com/hub/i/r/2015/10/13/…
    • Ramhound
      Ramhound about 8 years
    • amm
      amm about 8 years
      Don't know what you took as an agression, I just wanted to be clear, not only for you but for anybody. 1) I need to not enter the product key -and- 2) not specify product key on the .xml file; product key must remain empty, so the links you provided aren't useful in this case.
    • Ultrasonic54321
      Ultrasonic54321 almost 6 years
      What W10 edition are you using?
  • amm
    amm about 4 years
    Thanks for the answer Bart, somehow I missed it. I'm not working on that anymore. - - - I think I fixed the name part with a script (powershell or bat/cmd). - - - I corrected this small typo on the answer: <Value>PasswordHERE/Value> ## changed to: <Value>PasswordHERE</Value>