Ajouter l'installation de Windows au menu PXE
Objectif : proposer l'installation de Windows par le réseau dans le menu PXE, avec WinPE, iPXE et un partage Samba.
Structure des dossiers
mkdir -p /srv/tftp/winpe
Étape 3 — Ajouter l'install Windows au menu
L'installation Windows via PXE utilise WinPE (Windows Preinstallation Environment) servi via iPXE + SMB ou HTTP.
3.1 Prérequis
- Une machine Windows (physique ou VM) avec Windows ADK installé pour créer le WinPE
- L'ISO Windows 10 ou 11
- Un partage SMB (Samba) ou HTTP sur le LXC PXE pour servir les fichiers Windows
3.2 Installer Samba sur le LXC PXE
apt install -y samba
mkdir -p /srv/samba/windows
Configurer /etc/samba/smb.conf :
nano /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
server string = PXE Server
security = user
map to guest = bad user
guest account = nobody
[windows]
path = /srv/samba/windows
browseable = yes
read only = yes
guest ok = yes
comment = Windows Install Share
systemctl restart smbd
systemctl enable smbd
3.3 Créer le WinPE (depuis une machine Windows)
Sur une machine Windows avec Windows ADK + WinPE add-on installés :
# Ouvrir "Deployment and Imaging Tools Environment" en admin
# Créer l'environnement WinPE
copype amd64 C:\WinPE
# Monter l'image WinPE
Dism /Mount-Image /ImageFile:"C:\WinPE\media\sources\boot.wim" /index:1 /MountDir:"C:\WinPE\mount"
# Ajouter les drivers réseau si nécessaire (optionnel)
# Dism /Add-Driver /Image:"C:\WinPE\mount" /Driver:"C:\Drivers\NIC" /Recurse
# Démonter et valider
Dism /Unmount-Image /MountDir:"C:\WinPE\mount" /Commit
# Créer l'ISO WinPE
MakeWinPEMedia /ISO C:\WinPE C:\WinPE\WinPE.iso
3.4 Extraire les fichiers WinPE
Depuis la machine Windows, copier ces fichiers vers le partage SMB ou via SCP vers le LXC PXE :
C:\WinPE\media\Boot\BCD → /srv/tftp/winpe/BCD
C:\WinPE\media\Boot\boot.sdi → /srv/tftp/winpe/boot.sdi
C:\WinPE\media\sources\boot.wim → /srv/samba/windows/boot.wim
C:\WinPE\media\bootmgr → /srv/tftp/winpe/bootmgr
# Sur le LXC PXE, vérifier
ls -lh /srv/tftp/winpe/
ls -lh /srv/samba/windows/
3.5 Installer iPXE pour le boot Windows
Windows nécessite iPXE car pxelinux ne gère pas le boot WinPE nativement.
apt install -y ipxe
# Copier le fichier iPXE
cp /usr/lib/ipxe/undionly.kpxe /srv/tftp/
# Vérification
ls -lh /srv/tftp/undionly.kpxe
Créer le script iPXE pour Windows /srv/tftp/winpe/boot.ipxe :
nano /srv/tftp/winpe/boot.ipxe
#!ipxe
kernel http://192.168.200.23/winpe/bootmgr
initrd http://192.168.200.23/winpe/BCD BCD
initrd http://192.168.200.23/winpe/boot.sdi boot.sdi
initrd http://192.168.200.23/winpe/boot.wim boot.wim
boot
3.6 Installer un serveur HTTP pour WinPE
apt install -y nginx
# Créer un lien vers les fichiers WinPE
ln -s /srv/tftp/winpe /var/www/html/winpe
ln -s /srv/samba/windows /var/www/html/windows
systemctl restart nginx
systemctl enable nginx
# Test
curl http://192.168.200.23/winpe/
3.7 Copier l'ISO Windows dans le partage
Depuis une machine du réseau, copier le contenu de l'ISO Windows vers /srv/samba/windows/ :
# Monter l'ISO et copier (si tu as l'ISO sur le LXC)
mount -o loop /chemin/vers/windows.iso /mnt
cp -r /mnt/* /srv/samba/windows/
umount /mnt
# Permissions
chmod -R 755 /srv/samba/windows/
Mettre à jour /srv/tftp/pxelinux.cfg/default
nano /srv/tftp/pxelinux.cfg/default
DEFAULT menu.c32
PROMPT 0
TIMEOUT 100
ONTIMEOUT diskless
MENU TITLE ========================================
MENU TITLE PXE Boot Menu - rohba.local
MENU TITLE ========================================
# ─── Boot Diskless ───────────────────────────────
LABEL diskless
MENU LABEL >> Boot Diskless XFCE (NFS RW)
KERNEL vmlinuz
APPEND initrd=initrd.gz root=/dev/nfs nfsroot=192.168.200.23:/srv/nfs/rootfs,vers=3,rw ip=dhcp rw quiet
MENU SEPARATOR
# ─── Installation Debian ─────────────────────────
LABEL debian-install
MENU LABEL Installer Debian 12 Bookworm
KERNEL debian/vmlinuz
APPEND initrd=debian/initrd.gz --- quiet
LABEL debian-install-auto
MENU LABEL Installer Debian 12 (mode expert)
KERNEL debian/vmlinuz
APPEND initrd=debian/initrd.gz priority=low ---
MENU SEPARATOR
# ─── Installation Windows ────────────────────────
LABEL windows
MENU LABEL Installer Windows 10/11 (WinPE)
KERNEL undionly.kpxe
APPEND initrd=winpe/boot.ipxe
MENU SEPARATOR
# ─── Reboot / Local ──────────────────────────────
LABEL local
MENU LABEL Booter sur le disque local
LOCALBOOT 0
LABEL reboot
MENU LABEL Redémarrer
COM32 reboot.c32
Étape 5 — Ajouter reboot.c32
cp /usr/lib/syslinux/modules/bios/reboot.c32 /srv/tftp/
ls -lh /srv/tftp/reboot.c32