Nous souhaitons générer une image Windows 10 64 bits déployable via PXE sur nos clients en utilisant notre serveur Opsi comme serveur de boot.
Pour cela, il faut dans un premier temps générer un environnement de préinstallation autonome WinPE (pseudo système d’exploitation Live) pour une architecture 64 bits.
Dans ce but, nous utiliserons Windows ADK.
- Pour générer une image d’installation automatisée de Windows 7 ou Windows Serveur 2008 R2 : WAIK (Windows Automated Installation Kit)
- Pour générer une image d’installation automatisée de Windows 7 SP1 ou Windows Serveur 2008 R2 SP1 : WAIK (Windows Automated Installation Kit) et son supplément
- Pour générer une image d’installation automatisée de Windows 10 ou Windows 8/8.1 : ADK (Assessment and Deployment Kit)
Exécuter adksetup.exe et se laisser guider, en installant tous les modules.

Une fois l’installation terminée :
Ceci ouvre une ligne de commande dans le répertoire C:\Program Files\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools avec certaines variables d’environnements.
Cette partie précédant le prompt sera occultée dans un souci de visibilité :
C:\Program Files\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools>
copype.cmd <ARCH> C:\winpe
dism /Mount-Wim /WimFile:C:\winpe\media\sources\boot.wim /index:1 /MountDir:C:\winpe\mount
echo C:\opsi\startnet.cmd > "C:\winpe\mount\Windows\System32\startnet.cmd"
dism /Unmount-Wim /MountDir:C:\winpe\mount /Commit
Ci-dessus, <ARCH> représente l’architecture du système d’exploitation qui sera installé par la suite, dans notre cas 32 bits :
- x86 : pour les systèmes 32 bits
- amd64 : pour les systèmes 64 bits
Exemple pour un système 64 bits :
157 fichier(s) copié(s)
1 fichier(s) copié(s).
1 fichier(s) copié(s).
1 fichier(s) copié(s).
Success
Version : 10.0.14393.0
Montage de l’image
[==========================100.0%==========================]
L’opération a réussi.
Outil Gestion et maintenance des images de déploiement
Version : 10.0.14393.0
Fichier image : C:\winpe\media\sources\boot.wim
Index de l’image : 1
Enregistrement de l’image
[==========================100.0%==========================]
Démontage de l’image
[==========================100.0%==========================]
L’opération a réussi.
Remarques
Par défaut, le fichier starnet.cmd contient seulement la ligne suivante :
wpeinit
Après modification, il contient la ligne suivante :
C:\opsi\startnet.cmd
Le script startnet.cmd est généré par l’image de boot linux lors de l’appel au script Python /var/lib/opsi/depot/win7/setup.py
Il contient l’exécution du script work.cmd, copiant le fichier /var/lib/opsi/depot/win7/custom/unattend.xml puis appelant wpeinit
Les fichiers setup.py de chaque distribution sont identiques.
De plus, chaque distribution dispose de deux fichiers unattend.xml identiques entre eux (avant modification du custom) :
- /var/lib/opsi/depot/win7/custom/unattend.xml
- /var/lib/opsi/depot/win7/opsi/unattend.xml.template
Contrairement au script setup.py, le fichier unattend.xml est très différent entre les différentes distributions.
Contenu partiel du script /var/lib/opsi/depot/win7/setup.py :
#ligne 93 target = '/mnt/hd' #ligne 785 # Create work.cmd logger.notice("Creating work.cmd") f = open(target + '/opsi/work.cmd', 'w') print >> f, "@echo off\r" print >> f, "copy c:\\opsi\\unattend.xml x:\\unattend.xml >nul\r" print >> f, ":init\r" print >> f, "set mount_try_count=0\r" print >> f, "c:\\opsi\\SetWallpaper.exe c:\\opsi\\opsibg.bmp >nul 2>nul\r" print >> f, "echo Initializing ..... please wait ......\r" print >> f, "wpeinit\r" [...] #ligne 886 # Create startnet.cmd logger.notice(u"Creating startnet.cmd") f = open(target + '/opsi/startnet.cmd', 'w') print >> f, "@echo off\r" print >> f, "copy c:\\opsi\\work.cmd x:\\work.cmd >nul\r" print >> f, "x:\\work.cmd" f.close()
winpe/ ├── fwfiles/ │ ├── efisys.bin │ └── etfsboot.com ├── media/ │ ├── bg-bg/ │ │ └── bootmgr.efi.mui │ ├── Boot/ │ │ ├── BCD │ │ ├── bg-bg/ │ │ │ └── bootmgr.exe.mui │ │ ├── boot.sdi │ │ ├── bootfix.bin │ │ ├── cs-cz/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── da-dk/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── de-de/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── el-gr/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── en-gb/ │ │ │ └── bootmgr.exe.mui │ │ ├── en-us/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── es-es/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── es-mx/ │ │ │ └── bootmgr.exe.mui │ │ ├── et-ee/ │ │ │ └── bootmgr.exe.mui │ │ ├── fi-fi/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── Fonts/ │ │ │ ├── chs_boot.ttf │ │ │ ├── cht_boot.ttf │ │ │ ├── jpn_boot.ttf │ │ │ ├── kor_boot.ttf │ │ │ ├── malgun_boot.ttf │ │ │ ├── malgunn_boot.ttf │ │ │ ├── meiryo_boot.ttf │ │ │ ├── meiryon_boot.ttf │ │ │ ├── msjh_boot.ttf │ │ │ ├── msjhn_boot.ttf │ │ │ ├── msyh_boot.ttf │ │ │ ├── msyhn_boot.ttf │ │ │ ├── segmono_boot.ttf │ │ │ ├── segoe_slboot.ttf │ │ │ ├── segoen_slboot.ttf │ │ │ └── wgl4_boot.ttf │ │ ├── fr-ca/ │ │ │ └── bootmgr.exe.mui │ │ ├── fr-fr/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── hr-hr/ │ │ │ └── bootmgr.exe.mui │ │ ├── hu-hu/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── it-it/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── ja-jp/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── ko-kr/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── lt-lt/ │ │ │ └── bootmgr.exe.mui │ │ ├── lv-lv/ │ │ │ └── bootmgr.exe.mui │ │ ├── memtest.exe │ │ ├── nb-no/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── nl-nl/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── pl-pl/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── pt-br/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── pt-pt/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── Resources/ │ │ │ └── bootres.dll │ │ ├── ro-ro/ │ │ │ └── bootmgr.exe.mui │ │ ├── ru-ru/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── sk-sk/ │ │ │ └── bootmgr.exe.mui │ │ ├── sl-si/ │ │ │ └── bootmgr.exe.mui │ │ ├── sr-latn-rs/ │ │ │ └── bootmgr.exe.mui │ │ ├── sv-se/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── tr-tr/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── uk-ua/ │ │ │ └── bootmgr.exe.mui │ │ ├── zh-cn/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ ├── zh-hk/ │ │ │ ├── bootmgr.exe.mui │ │ │ └── memtest.exe.mui │ │ └── zh-tw/ │ │ ├── bootmgr.exe.mui │ │ └── memtest.exe.mui │ ├── bootmgr │ ├── bootmgr.efi │ ├── cs-cz/ │ │ └── bootmgr.efi.mui │ ├── da-dk/ │ │ └── bootmgr.efi.mui │ ├── de-de/ │ │ └── bootmgr.efi.mui │ ├── EFI/ │ │ ├── Boot/ │ │ │ ├── bootx64.efi │ │ │ └── en-us/ │ │ │ └── bootx64.efi.mui │ │ └── Microsoft/ │ │ └── Boot/ │ │ ├── BCD │ │ ├── cs-cz/ │ │ │ └── memtest.efi.mui │ │ ├── da-dk/ │ │ │ └── memtest.efi.mui │ │ ├── de-de/ │ │ │ └── memtest.efi.mui │ │ ├── el-gr/ │ │ │ └── memtest.efi.mui │ │ ├── en-us/ │ │ │ └── memtest.efi.mui │ │ ├── es-es/ │ │ │ └── memtest.efi.mui │ │ ├── fi-fi/ │ │ │ └── memtest.efi.mui │ │ ├── Fonts/ │ │ │ ├── chs_boot.ttf │ │ │ ├── cht_boot.ttf │ │ │ ├── jpn_boot.ttf │ │ │ ├── kor_boot.ttf │ │ │ ├── malgun_boot.ttf │ │ │ ├── meiryo_boot.ttf │ │ │ ├── msjh_boot.ttf │ │ │ ├── msyh_boot.ttf │ │ │ ├── segmono_boot.ttf │ │ │ ├── segoe_slboot.ttf │ │ │ └── wgl4_boot.ttf │ │ ├── fr-fr/ │ │ │ └── memtest.efi.mui │ │ ├── hu-hu/ │ │ │ └── memtest.efi.mui │ │ ├── it-it/ │ │ │ └── memtest.efi.mui │ │ ├── ja-jp/ │ │ │ └── memtest.efi.mui │ │ ├── ko-kr/ │ │ │ └── memtest.efi.mui │ │ ├── memtest.efi │ │ ├── nb-no/ │ │ │ └── memtest.efi.mui │ │ ├── nl-nl/ │ │ │ └── memtest.efi.mui │ │ ├── pl-pl/ │ │ │ └── memtest.efi.mui │ │ ├── pt-br/ │ │ │ └── memtest.efi.mui │ │ ├── pt-pt/ │ │ │ └── memtest.efi.mui │ │ ├── Resources/ │ │ │ └── bootres.dll │ │ ├── ru-ru/ │ │ │ └── memtest.efi.mui │ │ ├── sv-se/ │ │ │ └── memtest.efi.mui │ │ ├── tr-tr/ │ │ │ └── memtest.efi.mui │ │ ├── zh-cn/ │ │ │ └── memtest.efi.mui │ │ ├── zh-hk/ │ │ │ └── memtest.efi.mui │ │ └── zh-tw/ │ │ └── memtest.efi.mui │ ├── el-gr/ │ │ └── bootmgr.efi.mui │ ├── en-gb/ │ │ └── bootmgr.efi.mui │ ├── en-us/ │ │ └── bootmgr.efi.mui │ ├── es-es/ │ │ └── bootmgr.efi.mui │ ├── es-mx/ │ │ └── bootmgr.efi.mui │ ├── et-ee/ │ │ └── bootmgr.efi.mui │ ├── fi-fi/ │ │ └── bootmgr.efi.mui │ ├── fr-ca/ │ │ └── bootmgr.efi.mui │ ├── fr-fr/ │ │ └── bootmgr.efi.mui │ ├── hr-hr/ │ │ └── bootmgr.efi.mui │ ├── hu-hu/ │ │ └── bootmgr.efi.mui │ ├── it-it/ │ │ └── bootmgr.efi.mui │ ├── ja-jp/ │ │ └── bootmgr.efi.mui │ ├── ko-kr/ │ │ └── bootmgr.efi.mui │ ├── lt-lt/ │ │ └── bootmgr.efi.mui │ ├── lv-lv/ │ │ └── bootmgr.efi.mui │ ├── nb-no/ │ │ └── bootmgr.efi.mui │ ├── nl-nl/ │ │ └── bootmgr.efi.mui │ ├── pl-pl/ │ │ └── bootmgr.efi.mui │ ├── pt-br/ │ │ └── bootmgr.efi.mui │ ├── pt-pt/ │ │ └── bootmgr.efi.mui │ ├── ro-ro/ │ │ └── bootmgr.efi.mui │ ├── ru-ru/ │ │ └── bootmgr.efi.mui │ ├── sk-sk/ │ │ └── bootmgr.efi.mui │ ├── sl-si/ │ │ └── bootmgr.efi.mui │ ├── sources/ │ │ └── boot.wim │ ├── sr-latn-rs/ │ │ └── bootmgr.efi.mui │ ├── sv-se/ │ │ └── bootmgr.efi.mui │ ├── tr-tr/ │ │ └── bootmgr.efi.mui │ ├── uk-ua/ │ │ └── bootmgr.efi.mui │ ├── zh-cn/ │ │ └── bootmgr.efi.mui │ ├── zh-hk/ │ │ └── bootmgr.efi.mui │ └── zh-tw/ │ └── bootmgr.efi.mui └── mount/ 109 directories, 160 files
Toutefois, seul le contenu du dossier media nous intéresse.
Copier ensuite le contenu de C:\winpe\media sur le serveur opsi.opensharing.priv, dans le répertoire /var/lib/opsi/depot/win10-x64/winpe/ :
Définir les droits d’accès sur ce dossier :
# opsi-setup --set-rights /var/lib/opsi/depot/win10-x64/winpe/ [5] [Feb 14 13:59:24] Setting rights on directory u'/var/lib/opsi/depot/win10-x64/winpe' (Rights.py|121) # ls -lA /var/lib/opsi/depot/win10-x64/winpe/ total 1680 drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:52 bg-bg drwxrwx--- 40 opsiconfd pcpatch 4096 févr. 14 13:52 Boot -rwxrwx--- 1 opsiconfd pcpatch 386976 juil. 16 2016 bootmgr -rwxrwx--- 1 opsiconfd pcpatch 1168736 juil. 15 2016 bootmgr.efi drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:52 cs-cz drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:52 da-dk drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:52 de-de drwxrwx--- 4 opsiconfd pcpatch 4096 févr. 14 13:52 EFI drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 el-gr drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 en-gb drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 en-us drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 es-es drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 es-mx drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 et-ee drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 fi-fi drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 fr-ca drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 fr-fr drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 hr-hr drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 hu-hu drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 it-it drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 ja-jp drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 ko-kr drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 lt-lt drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 lv-lv drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 nb-no drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 nl-nl drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 pl-pl drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 pt-br drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 pt-pt drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 ro-ro drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 ru-ru drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 sk-sk drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 sl-si drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 sources drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 sr-latn-rs drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 sv-se drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 tr-tr drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 uk-ua drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 zh-cn drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 zh-hk drwxrwx--- 2 opsiconfd pcpatch 4096 févr. 14 13:53 zh-tw
Copier le contenu du CD d’installation de Windows 10 dans le répertoire suivant /var/lib/opsi/depot/win10-x64/installfiles/.

Définir les droits d’accès sur ce dossier :
# opsi-setup --set-rights q [5] [Feb 14 14:24:07] Setting rights on directory u'/var/lib/opsi/depot/win10-x64/installfiles' (Rights.py|121) # ls -lA /var/lib/opsi/depot/win10-x64/installfiles/ total 1628 -rwxrwx--- 1 opsiconfd pcpatch 128 juin 18 2015 autorun.inf drwxrwx--- 5 opsiconfd pcpatch 4096 févr. 14 13:48 boot -rwxrwx--- 1 opsiconfd pcpatch 395268 juil. 10 2015 bootmgr -rwxrwx--- 1 opsiconfd pcpatch 1152864 juil. 10 2015 bootmgr.efi drwxrwx--- 4 opsiconfd pcpatch 4096 févr. 14 13:48 efi -rwxrwx--- 1 opsiconfd pcpatch 152 juil. 10 2015 MediaMeta.xml -rwxrwx--- 1 opsiconfd pcpatch 80576 juil. 10 2015 setup.exe drwxrwx--- 11 opsiconfd pcpatch 12288 févr. 14 13:49 sources drwxrwx--- 3 opsiconfd pcpatch 4096 févr. 14 13:49 support
Aller plus loin