Skip to main content

Étape 11 — Préparer l'installation automatique

Le fichier autounattend.xml automatise entièrement l'installation de Windows. Placé à la racine de l'ISO, il est détecté automatiquement par l'installateur.

Ce que fait notre autounattend.xml Custom 1
  • Langue française partout (installation, clavier, fuseau horaire)
  • Sélection automatique de l'édition Pro (Index 6)
  • Acceptation automatique du CLUF (contrat de licence)
  • Bypass des vérifications matérielles (TPM, Secure Boot, RAM, stockage)
  • Bypass de l'obligation de connexion Internet et de compte Microsoft
  • Création du compte local Admin (administrateur, sans mot de passe)
  • Auto-logon au premier boot (1 fois, pour exécuter les scripts)
  • Skip complet de l'OOBE (pas de pubs, pas de configuration)
  • Lancement automatique du script d'installation des logiciels

Créer le fichier : 

Créez un fichier autounattend.xml avec le contenu suivant et placez-le dans le dossier de l'ISO extraite :

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
          xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">

    <!-- ============================================================ -->
    <!-- PHASE 1 : windowsPE (avant installation sur disque)          -->
    <!-- ============================================================ -->
    <settings pass="windowsPE">

        <component name="Microsoft-Windows-International-Core-WinPE"
                   processorArchitecture="amd64"
                   publicKeyToken="31bf3856ad364e35"
                   language="neutral"
                   versionScope="nonSxS">
            <SetupUILanguage>
                <UILanguage>fr-FR</UILanguage>
            </SetupUILanguage>
            <InputLocale>fr-FR</InputLocale>
            <SystemLocale>fr-FR</SystemLocale>
            <UILanguage>fr-FR</UILanguage>
            <UserLocale>fr-FR</UserLocale>
        </component>

        <component name="Microsoft-Windows-Setup"
                   processorArchitecture="amd64"
                   publicKeyToken="31bf3856ad364e35"
                   language="neutral"
                   versionScope="nonSxS">

            <!-- Sélection de l'édition Pro -->
            <ImageInstall>
                <OSImage>
                    <InstallFrom>
                        <MetaData wcm:action="add">
                            <Key>/IMAGE/INDEX</Key>
                            <Value>6</Value>
                        </MetaData>
                    </InstallFrom>
                </OSImage>
            </ImageInstall>

            <UserData>
                <AcceptEula>true</AcceptEula>
                <FullName>Admin</FullName>
                <Organization>Organisation</Organization>
            </UserData>

            <!-- Bypass vérifications matérielles -->
            <RunSynchronous>
                <RunSynchronousCommand wcm:action="add">
                    <Order>1</Order>
                    <Path>reg add HKLM\SYSTEM\Setup\LabConfig /v BypassTPMCheck /t REG_DWORD /d 1 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>2</Order>
                    <Path>reg add HKLM\SYSTEM\Setup\LabConfig /v BypassSecureBootCheck /t REG_DWORD /d 1 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>3</Order>
                    <Path>reg add HKLM\SYSTEM\Setup\LabConfig /v BypassRAMCheck /t REG_DWORD /d 1 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>4</Order>
                    <Path>reg add HKLM\SYSTEM\Setup\LabConfig /v BypassStorageCheck /t REG_DWORD /d 1 /f</Path>
                </RunSynchronousCommand>
            </RunSynchronous>

        </component>
    </settings>

    <!-- ============================================================ -->
    <!-- PHASE 2 : specialize                                         -->
    <!-- ============================================================ -->
    <settings pass="specialize">
        <component name="Microsoft-Windows-Deployment"
                   processorArchitecture="amd64"
                   publicKeyToken="31bf3856ad364e35"
                   language="neutral"
                   versionScope="nonSxS">
            <RunSynchronous>
                <!-- Bypass obligation connexion Internet -->
                <RunSynchronousCommand wcm:action="add">
                    <Order>1</Order>
                    <Path>reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE /v BypassNRO /t REG_DWORD /d 1 /f</Path>
                </RunSynchronousCommand>
            </RunSynchronous>
        </component>
    </settings>

    <!-- ============================================================ -->
    <!-- PHASE 3 : oobeSystem (premier démarrage)                     -->
    <!-- ============================================================ -->
    <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">

            <!-- Skip OOBE complet -->
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
                <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
                <HideLocalAccountScreen>true</HideLocalAccountScreen>
                <ProtectYourPC>3</ProtectYourPC>
            </OOBE>

            <!-- Compte local Admin (sans mot de passe) -->
            <UserAccounts>
                <LocalAccounts>
                    <LocalAccount wcm:action="add">
                        <Name>Admin</Name>
                        <Group>Administrators</Group>
                        <Password>
                            <Value></Value>
                            <PlainText>true</PlainText>
                        </Password>
                    </LocalAccount>
                </LocalAccounts>
            </UserAccounts>

            <!-- Auto-logon 1 fois (pour exécuter SetupComplete) -->
            <AutoLogon>
                <Enabled>true</Enabled>
                <Username>Admin</Username>
                <Password>
                    <Value></Value>
                    <PlainText>true</PlainText>
                </Password>
                <LogonCount>1</LogonCount>
            </AutoLogon>

            <!-- Fuseau horaire France -->
            <TimeZone>Romance Standard Time</TimeZone>

            <!-- Lancer le script d'installation logiciels -->
            <FirstLogonCommands>
                <SynchronousCommand wcm:action="add">
                    <Order>1</Order>
                    <CommandLine>cmd /c C:\Windows\Setup\Scripts\SetupComplete.cmd</CommandLine>
                    <Description>Installation des logiciels</Description>
                    <RequiresUserInput>false</RequiresUserInput>
                </SynchronousCommand>
            </FirstLogonCommands>

        </component>

        <!-- Langue et clavier utilisateur -->
        <component name="Microsoft-Windows-International-Core"
                   processorArchitecture="amd64"
                   publicKeyToken="31bf3856ad364e35"
                   language="neutral"
                   versionScope="nonSxS">
            <InputLocale>fr-FR</InputLocale>
            <SystemLocale>fr-FR</SystemLocale>
            <UILanguage>fr-FR</UILanguage>
            <UserLocale>fr-FR</UserLocale>
        </component>

    </settings>

</unattend>

Copier à la racine de l'ISO extraite :

copy C:\autounattend.xml C:\Win11_Custom\iso_extracted\autounattend.xml

Le fichier doit se trouver à côté de setup.exe dans C:\Win11_Custom\iso_extracted\.

Ce que fait notre autounattend.xml Custom 2
  • Langue française partout (installation, clavier, fuseau horaire)
  • Sélection automatique de l'édition Pro (Index 6)
  • Acceptation automatique du CLUF (contrat de licence)
  • Bypass des vérifications matérielles (TPM, Secure Boot, RAM, stockage)
  • Bypass de l'obligation de connexion Internet et de compte Microsoft
  • Choix manuel de la partition
  • Écran de création de compte local
  • Skip partiel de l'OOBE (EULA, réseau, vie privée sautés seul l'écran de compte reste)
  • Copie automatique des scripts depuis le dossier CustomScripts\ de la clé USB vers C:\Windows\Setup\Scripts\
  • Lancement automatique du script d'installation des logiciels au premier login (via RunOnce)

Créez un fichier autounattend.xml avec le contenu suivant et placez-le dans le dossier de l'ISO extraite :

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
          xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">

    <!-- ============================================================ -->
    <!-- PHASE 1 : windowsPE - Configuration initiale de l'installeur -->
    <!-- ============================================================ -->
    <settings pass="windowsPE">

        <!-- Langue de l'installeur -->
        <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>fr-FR</UILanguage>
            </SetupUILanguage>
            <InputLocale>fr-FR</InputLocale>
            <SystemLocale>fr-FR</SystemLocale>
            <UILanguage>fr-FR</UILanguage>
            <UserLocale>fr-FR</UserLocale>
        </component>

        <!-- Sélection de l'image et clé produit -->
        <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">

            <!-- Sélection automatique de l'édition Pro (Index 6) -->
            <ImageInstall>
                <OSImage>
                    <InstallFrom>
                        <MetaData wcm:action="add">
                            <Key>/IMAGE/INDEX</Key>
                            <Value>6</Value>
                        </MetaData>
                    </InstallFrom>
                    <!-- PAS de InstallTo = choix manuel de la partition -->
                </OSImage>
            </ImageInstall>

            <UserData>
                <AcceptEula>true</AcceptEula>
                <FullName>Admin</FullName>
                <Organization>Organisation</Organization>
            </UserData>

            <!-- Bypass vérifications matérielles (TPM, Secure Boot, RAM, stockage) -->
            <RunSynchronous>
                <RunSynchronousCommand wcm:action="add">
                    <Order>1</Order>
                    <Path>reg add HKLM\SYSTEM\Setup\LabConfig /v BypassTPMCheck /t REG_DWORD /d 1 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>2</Order>
                    <Path>reg add HKLM\SYSTEM\Setup\LabConfig /v BypassSecureBootCheck /t REG_DWORD /d 1 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>3</Order>
                    <Path>reg add HKLM\SYSTEM\Setup\LabConfig /v BypassRAMCheck /t REG_DWORD /d 1 /f</Path>
                </RunSynchronousCommand>
                <RunSynchronousCommand wcm:action="add">
                    <Order>4</Order>
                    <Path>reg add HKLM\SYSTEM\Setup\LabConfig /v BypassStorageCheck /t REG_DWORD /d 1 /f</Path>
                </RunSynchronousCommand>
            </RunSynchronous>

        </component>
    </settings>

    <!-- ============================================================ -->
    <!-- PHASE 4 : specialize - Copie des scripts + configuration     -->
    <!-- ============================================================ -->
    <settings pass="specialize">

        <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>

                <!-- Bypass OOBE Internet requirement (permet compte local) -->
                <RunSynchronousCommand wcm:action="add">
                    <Order>1</Order>
                    <Path>reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\OOBE /v BypassNRO /t REG_DWORD /d 1 /f</Path>
                </RunSynchronousCommand>

                <!-- Créer le dossier cible pour les scripts -->
                <RunSynchronousCommand wcm:action="add">
                    <Order>2</Order>
                    <Path>cmd /c mkdir C:\Windows\Setup\Scripts</Path>
                </RunSynchronousCommand>

                <!-- Copier les scripts depuis le média d'installation (USB/DVD) -->
                <!-- Parcourt les lettres D à L pour trouver le dossier CustomScripts -->
                <RunSynchronousCommand wcm:action="add">
                    <Order>3</Order>
                    <Path>cmd /c "for %%d in (D E F G H I J K L) do if exist %%d:\CustomScripts\InstallApps.ps1 (copy /Y %%d:\CustomScripts\*.* C:\Windows\Setup\Scripts\ &amp; exit /b 0)"</Path>
                </RunSynchronousCommand>

                <!-- RunOnce : lancer le script au premier login utilisateur -->
                <RunSynchronousCommand wcm:action="add">
                    <Order>4</Order>
                    <Path>reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /v InstallApps /t REG_SZ /d "cmd /c start /wait powershell.exe -ExecutionPolicy Bypass -NoProfile -File C:\Windows\Setup\Scripts\InstallApps.ps1" /f</Path>
                </RunSynchronousCommand>

            </RunSynchronous>
        </component>

    </settings>

    <!-- ============================================================ -->
    <!-- PHASE 7 : oobeSystem - Configuration OOBE (premier démarrage) -->
    <!-- ============================================================ -->
    <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">

            <!-- OOBE : skip maximum, MAIS laisser l'écran de création de compte local -->
            <OOBE>
                <HideEULAPage>true</HideEULAPage>
                <HideOnlineAccountScreens>true</HideOnlineAccountScreens>
                <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
                <ProtectYourPC>3</ProtectYourPC>
            </OOBE>

            <!-- PAS de UserAccounts = l'OOBE demande le nom + mot de passe -->
            <!-- PAS de AutoLogon = l'utilisateur se connecte normalement -->

            <!-- Fuseau horaire France -->
            <TimeZone>Romance Standard Time</TimeZone>

        </component>

        <!-- Langue et clavier pour l'utilisateur -->
        <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>fr-FR</InputLocale>
            <SystemLocale>fr-FR</SystemLocale>
            <UILanguage>fr-FR</UILanguage>
            <UserLocale>fr-FR</UserLocale>
        </component>

    </settings>

</unattend>