Create media for automated unattended install of Windows 10  

Page 81 of 82 FirstFirst ... 317179808182 LastLast
  1. hsehestedt's Avatar
    Posts : 2,482
    Windows 11 Pro, 21H2

    ROFL. Kari, you are amazing. I was about to try resorting to en-GB because everything else looks good except the blasted formats like currency.

    nzwazza, I still have some additional comments. Will those to you soon after I try Kari's suggestion.
      My Computers

  2. Kari's Avatar
    Posts : 17,607
    Windows 10 Pro
    Thread Starter

    hsehestedt said:
    ...everything else looks good except the blasted formats like currency.
    Setting UI language correctly, then setting both SystemLocale and UserLocale to EN-NZ should set location, timezone, time format, number formats, and currency correctly.

      My Computer

  3. hsehestedt's Avatar
    Posts : 2,482
    Windows 11 Pro, 21H2

    Thanks, Kari. What I meant was that in my experiments it wasn't getting set correctly. I'll test your suggestion, but as always, I have no doubt that it will work as you say .


    A few more comments for you...

    Remember that Kari's tutorial assumes that you are going to setup a Technician System and a Reference System. If you don't want to setup a reference system and you want only to perform an unattended install with an autounattend.xml answer file, do this:

    Follow the steps in the tutorial up to and including step 3.19.

    Skip to 4.1 and follow the steps up to and including 4.8 with the following exceptions:

    In 4.3, DO NOT set CopyProfile to TRUE.

    In 4.4, note that you will have to manually copy your logo to C:\Windows\System32\oemlogo.bmp after installation if you plan to use one since there is no Reference System from which this file will be obtained.

    Once you have completed step 4.8, go back to 3.20 to verify and save your autounattend.xml answer file OR do the optional procedure below first and then go back to step 3.20

    Completely optional step...

    Using the steps up until this point, Windows installation will proceed to the point where you logon for the first time. During that first logon it takes another several minutes for setup to complete because you get the screens that say things like "Hi", "We're setting everything up for you", "This may take a few minutes", "Almost done", etc.

    If you want to automate this then you can add a onetime autologon by making the following additions to your answer file, otherwise just skip this optional item and proceed to step 3.20 to finalize your answer file. Note that if you set a blank password, you will be automatically logged in and this procedure is not needed in that case.

    From the Windows Image pane in Windows System Image Manager, expand Shell-Setup. Add both AutoLogon and FirstLogonCommands to Pass 7 oobe System.

    Select Shell-Setup > AutoLogon in the Answer File pane and set the following values:

    Enabled:	true
    LogonCount:	1
    Username:	<Use an admin username you created>
    Expand AutoLogon and select Password.

    Set Value to the password for the username you just specified.


    1) There seems to be a problem with this field accepting a blank password. To work around this, enter anything in the Value field, making sure to hit Enter afterward. Then clear the password and again hit Enter. The password is now set to a blank password.

    2) If you are going to change the password, you may have to delete the whole Shell-Setup > UserAccounts section and recreate it. Do the same for the Shell-Setup > AutoLogon block.

    Right click on FirstLogonCommands in the Answer File pane and select Insert New SynchronousCommand.

    Select SynchronousCommand and set the following two values (Note that the first entry for CommandLine is a long line and will wrap in this document. It ends with the /f)

    CommandLine:	reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v AutoLogonCount /t REG_DWORD /d 0 /f
    Order:		1
    NOTE: The entry you just made adds a registry entry because of a bug with how AutoLogon is handled. AutoLogon erroneously adds 1 to LogonCount value. As a result, you must subtract 1 from the number of times you want it to logon. To logon once, you must make the LogonCount 0. Unfortunately, Windows properly understands a LogonCount of 0 as meaning Never AutoLogon. To correct this, we must make the LogonCount 1 and use the registry entry to correct for this problem.
      My Computers

  4. Posts : 9

    @Kari - thanks for your help, that worked!
    @hsehestedt - thanks for your time and effort, I implemented the AutoLogon / FirstLogonCommands and that is working beautifully, it's exactly what I needed to happen.

    Was wondering if someone could please help a little further, I have added a second SynchronousCommand (1. screenshot below) to run a powershell script but I noticed post-installation on the target VM that the script didn't run. When I try and run it manually via an elevated powershell it complains about the lack of execution policy (2. screenshot below)

    the SychronousCommand I am running is: powershell -File "C:\temp\winRM.ps1"

    Do I need to do something like: powershell -ExecutionPolicy Bypass -File "C:\temp\winRM.ps1" ?



    Any help would be appreciated
      My Computer

  5. hsehestedt's Avatar
    Posts : 2,482
    Windows 11 Pro, 21H2

    Not sure if that is the right place for running a PowerShell script. I'd have to look at that. But here are my notes that I saved for running stuff after Windows setup. Maybe some of these notes will help. More likely, Kari will hopefully have even better insights

    Optional: Automating Actions Upon Completion of Windows Setup

    Run a script after setup is complete (SetupComplete.cmd)

    %WINDIR%\Setup\Scripts\SetupComplete.cmd Order of Operations

    1. After Windows is installed but before the logon screen appears, Windows Setup searches for the SetupComplete.cmd file in the %WINDIR%\Setup\Scripts\ directory.

    2. If a SetupComplete.cmd file is found, Windows Setup runs the script. Windows Setup logs the action in the C:\Windows\Panther\UnattendGC\Setupact.log file.

    Setup does not verify any exit codes or error levels in the script after it executes SetupComplete.cmd.

    Warning: You cannot reboot the system and resume running SetupComplete.cmd. You should not reboot the system by adding a command such as shutdown -r. This will put the system in a bad state.

    3. If the computer joins a domain during installation, the Group Policy that is defined in the domain is not applied to the computer until Setupcomplete.cmd is finished. This is to make sure that the Group Policy configuration activity does not interfere with the script.

    Windows Unattended scripts:

    Create an Unattend.xml file with one of these settings to run during the Windows Setup process. This can be used with OEM product keys.

    NOTE: As of Windows 10, Microsoft-Window-Shell-Setup\LogonCommands\AsynchronousCommand now works like LogonCommands\AsynchronousCommand: all commands using these settings now start at the same time and won't wait for the previous command to finish.

    Some of these settings run in the user context, others run in the system context depending on the configuration pass.

    Add Microsoft-Windows-Setup\RunAsynchronousCommand or RunSynchronousCommand to run a script as Windows Setup starts. This can be helpful for setting hard disk partitions.

    Add Microsoft-Windows-Deployment\RunAsynchronousCommand or RunSynchronousCommand to the auditUser configuration pass to run a script that runs when the PC enters audit mode. This can be helpful for tasks like automated app installation or testing.

    Add Microsoft-Windows-Shell-Setup\LogonCommands\AsynchronousCommand or FirstLogonCommands\SynchronousCommand to run after the Out of Box Experience (OOBE) but before the user sees the desktop. This can be especially useful to set up language-specific apps or content after the user has already selected their language.

    Use these scripts sparingly because long scripts can prevent the user from reaching the Start screen quickly. For retail versions of Windows, additional restrictions apply to these scripts. For info, see the Licensing and Policy guidance on the OEM Partner Center.

    NOTE: When you add a script using FirstLogonCommands, it will be triggered on the next boot, even if you boot into audit mode using Ctrl+Shift+F3. To boot to audit mode without triggering these scripts, add the setting: Microsoft-Windows-Deployment\Reseal\Mode = Audit.

    Installing Apps from the RunOnce.bat

    If you need to modify the Runonce.bat file to install apps or perform other actions, you can add the following lines to allow Windows to determine the drive letter of the installation media:

    FOR %%I IN (A B C D E F G H I J K L M N O P Q R S T U V W X Y Z) DO IF EXIST %%I:\Installers\installationstuff.txt SET DRIVE=%%I

    This line will search each drive letter for a file in the root called "installationstuff.txt". Once found, the drive letter will be saved in the variable DRIVE. This allows you to install apps as in this example:

    "%DRIVE%:\Installers\MyApp" /s

    Note that you can replace the filename with any path and filename you wish and RunOnce.bat can also be named anything.

    If you need to modify the RunOnce.bat in an existing sysprep image, do this:

    NOTE: I won't provide every command to perform the below steps. You can find that information elsewhere in this document. The section on injecting updates has all the DISM commands for mounting, unmounting, and ISO image burning.

    Extract Windows to a location such as C:\Project\ISO_Files.

    Mount the install.wim to a location such as C:\Project\Mount.

    From the mounted install.wim, go to this location (replace WinUser with an Admin user you created other than Administrator):

    C:\Project\Mount\Users\WinUser\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

    Modify the RunOnce.bat

    Place the Installers folder and installationstuff.txt files in the C:\Project\ISO_Files folder - again, modify as desired, but make sure your RunOnce.bat references the correct location(s).

    Unmount the install.wim.

    Create a new ISO image. 
      My Computers

  6. Posts : 9


    Thanks for your info above I managed to get it working

    The last bit of help I need is, does anyone know how I can set a static computername? I see the option appears to be deprecated for Windows 10 - I can see it in the ADK but when I add it to the answerfile the windows shell computername option disappears.

    I just need to set a static computername and I can deliver this project, any ideas?
      My Computer

  7. hsehestedt's Avatar
    Posts : 2,482
    Windows 11 Pro, 21H2

    Take a look at step 4.3 of Kari's tutorial. Kari does not have you specify a computer name here but you could if you wanted to do so. You have 3 choices:

    1) Leave blank (as Kari does) and a random computer name will be generated.

    2) Put an asterisk (*) in this field and then the random name of the computer will be replaced by a string of up to 8 characters maximum that is made up from the RegisteredOrganization and RegisteredOwner values with the remaining characters being random.

    3) You can also specify a name of up to 15 characters in length. This would give you your static name.
      My Computers

  8. Posts : 9

    Thanks mate,
    I misread the information from

    I used the specialize portion of the answer file and I am good as gold.

    Thanks for all your help. I delivered the project
      My Computer

  9. BlueShark's Avatar
    Posts : 3
    Windows 10

    Just wanted to stop by and let you all know that I used this guide for Windows 11 21H2 today and it worked fine with some things to notice:

    • I have only tested the sutounattend for Windows 11 PRO.
    • I skipped the sysprep part. I have just configured windows to make a local account and login.
    • Under OSImage and InstallFrom I had to add a metadata key like this:

              <MetaData wcm:action="add">
                  <Value>Windows 10 Pro</Value>
      Note that we still have to write Windows 10 Pro, not Windows 11 Pro.
    • I also skipped adding assets and selecting drive.
    • Please note (and this should be stated in the guide really...) that copyprofile is very buggy and does not work with the start menu or the taskbar anymore. This is old news, but I spent hours trying to figure this out because the guide didn't say anything about it...

    So far it seems Windows 11 is similar to Windows 10 when it comes to making an answer file 😀 but this might change over time.
      My Computer

  10. hsehestedt's Avatar
    Posts : 2,482
    Windows 11 Pro, 21H2

    Welcome to TenForums!

    BlueShark, I'm a bit unclear as to why it is that you say you needed to add that MetaData section. What issue is that intended to resolve? In creating answer files for Windows 11, that is certainly not something that I have needed to do.

    I'm just curious what it was that you ran into that made you resort to adding that section.
      My Computers

Page 81 of 82 FirstFirst ... 317179808182 LastLast

Tutorial Categories

Create media for automated unattended install of Windows 10 Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone

  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd
All times are GMT -5. The time now is 21:26.
Find Us

Windows 10 Forums