Windows 10 making a iso from a usb drive with 3 partitions

Page 2 of 2 FirstFirst 12

  1. Posts : 129
    Windows 10 Pro
    Thread Starter
       #11

    Yes i do have the original windows with all drivers
    But
    I would like to use a answer file or/and a batch to use to install the drivers before oobe.
    I am going to build my own wim file with drivers so they will install right before oobe in windows 10 setup.
    Can i use the pnp section of windows image manager to install this wireless driver? If so which inf file .inf do i use or do i use all of them? Can i use all of them in windows system manager in the adk?

    If i wanted to use the .exe files would i use asychronous or synchronous?
    Thank you in advance. Jtm
      My Computer


  2. Posts : 4,187
    Windows 11 Pro, 22H2
       #12

    I have not really used these methods myself, but I have made myself notes on how to perform actions at the completion of Windows setup. Hopefully these notes can help you. Read through this, and let me know if you need any further help. I would be happy to do some testing to help but be aware that it may take me a little while:


    * 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. The SetupComplete.cmd should be allowed to run to completion.

    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 Unattend scripts:

    Create one of these settings in your unattend.xml answer file to run during the Windows setup process.

    NOTE: 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 Setup > RunAsynchronousCommand or RunSynchronousCommand to run a script as Windows Setup starts. This can be helpful for setting hard disk partitions.

    • Add 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 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. Note that FirstLogonCommands runs only once but LogonCommands runs each time.

    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 Microsoft 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: Deployment > Reseal > Mode = Audit.

    Installing Apps from the RunOnce.bat

    If you need to modify the Runonce.bat file discussed previously 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


  3. Posts : 782
    Windows 7
       #13

    hsehestedt said:
    Setup does not verify any exit codes or error levels in the script after it executes SetupComplete.cmd.
    You're allowed have an optional ErrorHandler.cmd script in the same folder as SetupComplete.cmd, to run if any errors were flagged.
    Run a script if Windows Setup encounters a fatal error (ErrorHandler.cmd)

    hsehestedt said:
    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. The SetupComplete.cmd should be allowed to run to completion.
    Rebooting inside SetupComplete is not considered good practice, however it can be done as the absolutely last command in the script. Depending on the grace period for the shutdown command, any script commands listed after the shutdown may be skipped. When the system restarts, SetupComplete is abandoned and you drop into the first user logon.

    This doesn't put the system in "bad state", but unlike the specialize pass it won't resume execution where SetupComplete was interrupted by a restart. It can be legitimately used where a reboot is required for a recently installed driver, or installed KB update which requires a restart (ie. .NET updates).
      My Computer


  4. Posts : 4,187
    Windows 11 Pro, 22H2
       #14

    garlin said:
    You're allowed have an optional ErrorHandler.cmd script in the same folder as SetupComplete.cmd, to run if any errors were flagged.
    Run a script if Windows Setup encounters a fatal error (ErrorHandler.cmd)



    Rebooting inside SetupComplete is not considered good practice, however it can be done as the absolutely last command in the script. Depending on the grace period for the shutdown command, any script commands listed after the shutdown may be skipped. When the system restarts, SetupComplete is abandoned and you drop into the first user logon.

    This doesn't put the system in "bad state", but unlike the specialize pass it won't resume execution where SetupComplete was interrupted by a restart. It can be legitimately used where a reboot is required for a recently installed driver, or installed KB update which requires a restart (ie. .NET updates).
    Thanks for the clarifications, garlin. As I noted, I have not used those methods so my notes came straight out of Microsoft docs, but as usual, people with real world experience like yourself often can put a finer point on these things, so this is very much appreciated. I'll update my notes with your comments.
      My Computers


  5. Posts : 4,187
    Windows 11 Pro, 22H2
       #15

    @RBCC,

    If I may, I'd like to just offer one alternative possibility and a little commentary on why I like to use this. Just some food for thought. Feel free to ignore if you don't like this, just want to provide you with options and save you some work.

    First, I tend to use the same unattended answer file on all of my systems (with the rare exception). It is true that I have a collection of different answer files, but those are mainly for testing purposes. When I actually install on my real PCs, I use the same answer file everywhere. I could not do that if I was trying to install system specific drivers from my answer files. In that case I would have to modify the answer file for every system. Another problem would be that every time new drivers came out, I would have to update my Windows image. Here is a far simpler method:

    Export all the drivers from your system. This requires only a single command. Here is an example:

    pnputil /export-driver * C:\Driver_Backups

    That's it! Now you have all your drivers backed up. Save them someplace safe like on a thumb drive.

    Now, if you ever reinstall Windows (either manually or unattended, it does not matter), right after installation, simply run this command:

    pnputil /add-driver D:\Driver_Backups\*.inf /subdirs /install

    NOTE: The above command assumes that the folder with drivers you previously exported is D:\Driver_Backups.

    Again, it's that simple. You have just installed ALL of your drivers with a single command.

    As I noted, this prevents you from having to update your Windows image again with new drivers. All you need to do when you install new drivers is run the pnputil command to export the drivers if you want all the latest drivers in your export. It's just that simple.
      My Computers


  6. Posts : 782
    Windows 7
       #16

    You can search for driver folders during the WinPE pass, instead of waiting to run pnputil after the install.
    Code:
    <settings pass="windowsPE">
                    <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>
                                    <ProductKey>
                                            <Key></Key>
                                    </ProductKey>
                            </UserData>
                    </component>
                    <component name="Microsoft-Windows-PnpCustomizationsWinPE" 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">
                            <DriverPaths>
                                    <PathAndCredentials wcm:action="add" wcm:keyValue="1">
                                            <Path>D:\Driver_Backups</Path>
                                    </PathAndCredentials>
                            </DriverPaths>
                            <DriverPaths>
                                    <PathAndCredentials wcm:action="add" wcm:keyValue="2">
                                            <Path>E:\Driver_Backups</Path>
                                    </PathAndCredentials>
                            </DriverPaths>
                     </component>
            </settings>

    The only problem is you can't guarantee your install media's assigned drive letter. To cover your bases, list a few extra driver paths (on drives E, F, G). There's no harm in adding folders which don't exist on the install.

    Now copy all your exported drivers under a single \Driver_Backups folder on the ISO's root.
    Last edited by garlin; 25 Feb 2024 at 22:24.
      My Computer


 

  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 07:41.
Find Us




Windows 10 Forums