Create media for automated unattended install of Windows 10  

Page 81 of 81 FirstFirst ... 3171798081
  1. hsehestedt's Avatar
    Posts : 2,428
    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,597
    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,428
    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 : 7

    @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,428
    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

Page 81 of 81 FirstFirst ... 3171798081

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 03:05.
Find Us

Windows 10 Forums