Le démarrage de Windows 

Comprendre le Boot de Windows (depuis Vista)


######################################################################################################
###### SYSTEM BOOTSTRAP in DETAILS ###################################################################
######################################################################################################
On IBM PC-compatible computers, the bootstrapping firmware contained within the ROM BIOS loads and executes 
the master boot record. The PC/XT (type 5160) used an Intel 8088 microprocessor. In order to remain compatible, 
all x86 architecture systems start with the microprocessor in an operating mode referred to as real mode. 
The BIOS reads the MBR from the storage device into physical memory, and then it directs the microprocessor 
to the start of the boot code. Since the BIOS runs in real mode, the processor is in real mode when the MBR 
program begins to execute, and so the beginning of the MBR is expected to contain real mode machine language 
instructions.
Due to the restricted size of the MBR's code section, it typically contains only a small program that copies 
additional code (such as a boot loader) from the storage device into memory. Control is then passed to this 
code, which is responsible for loading the actual operating system. This process is known as chain loading.
Popular MBR code programs were created for booting PC DOS and MS-DOS, and similar boot code remains in 
wide use. These boot sectors expect the fdisk partition table scheme to be in use, and scans the list of 
partitions in the MBR's embedded partition table to find the only one that is marked with the active flag.
It then loads and runs the volume boot record (VBR) of the active partition (second stage boot loader)
REMARQUE IMPORTANTE : 
On machines that do not use x86 processors, or on x86 machines with non-BIOS firmware such as Open Firmware 
or Extensible Firmware Interface (EFI) firmware, this design is unsuitable, and the MBR is not used as part 
of the system bootstrap. EFI firmware is instead capable of directly understanding the GPT partitioning 
scheme and the FAT filesystem format, and loads and runs programs held as files in the EFI System partition.
The MBR will be involved only insofar as it might contain a partition table for compatibility purposes if 
the GPT partition table scheme has been used.
There is some MBR replacement code that emulates EFI firmware's bootstrap, which makes non-EFI machines 
capable of booting from disks using the GPT partitioning scheme. It detects a GPT, places the processor 
in the correct operating mode, and loads the EFI compatible code from disk to complete this task.
Principe  BOOT PROCESS :
------------------------
BIOS  --> Load MBR  (BIOS code reads MBR which is the first sector of the bootable hard drive = boot sector)
  MBR --> Control is transfered to MBR which then execute the Boot sequence or boot code (in real mode)
    MBR    --> MBR code execution locate active partition on the disk and read first sector of VBR ( Volume Boot Record)
      VBR    --> Control is transfered to this specific boot code of the VBR which is executed (in real mode)
VBR    --> VBR Code execution loads Bootstrap code (= OS boot loader’s components)
   NB : In fact, there are 15 consecutive sectors following the VBR and these contain bootstrap code for the NTFS partition
 Boot Code  --> Control is transfered to the bootstrap code which is executed (in real mode/protected mode)
   Boot Code --> This code execution loads BOOTMGR (in real mode/protected mode)
     Bootmgr      --> Bootmgr is executed in order to load Winload.exe (or Winresume.exe) - (in real mode/protected mode)
Winload.exe  --> Winload.exe is executed to Load Kernel and Boot Start Drivers (in real mode/protected mode)

Master Boot Record :
--------------------
A master boot record (MBR) is a special type of boot sector at the very beginning of partitioned computer 
mass storage devices like fixed disks or removable drives intended for use with IBM PC-compatible systems 
and beyond. The concept of MBRs was publicly introduced in 1983 with PC DOS 2.0.
The MBR holds the information on how the logical partitions, containing file systems, are organized on that 
medium. Besides that, the MBR also contains executable code to function as a loader for the installed operating 
system—usually by passing control over to the loader's second stage, or in conjunction with each partition's 
volume boot record (VBR). This MBR code is usually referred to as a boot loader.
The organization of the partition table in the MBR limits the maximum addressable storage space of a disk 
to 2 TB (232 × 512 bytes).[1] Therefore, the MBR-based partitioning scheme is in the process of being 
superseded by the GUID Partition Table (GPT) scheme in new computers. A GPT can coexist with an MBR in 
order to provide some limited form of backward compatibility for older systems.
MBRs are not present on non-partitioned media like floppies, superfloppies or other storage devices 
configured to behave as such.
The MBR consists of 512 or more bytes located in the first sector of the drive.
It may contain one or more of:
- A partition table describing the partitions of a storage device.
In this context the boot sector may also be called a partition sector.
- Bootstrap code: Instructions to identify the configured bootable partition, 
then load and execute its volume boot record (VBR) as a chain loader.
- Optional 32-bit disk timestamp.
- Optional 32-bit disk signature.

Volume Boot Record :
--------------------
A Volume Boot Record (VBR) (also known as a volume boot sector, a partition boot record or a partition 
boot sector) is a type of boot sector introduced by the IBM Personal Computer.
The code in volume boot records is invoked either directly by the machine's firmware or indirectly by code 
in the master boot record or a boot manager. Code in the MBR and VBR is in essence loaded the same way !!
It is often referred as the Second-stage boot loader.
Exemple of boot manager code that can be load by VBRE are : GRUB, BOOTMGR, Syslinux, or NTLDR : they are not themselves operating 
systems, but are able to load an operating system properly and transfer execution to it; the operating 
system subsequently initializes itself and may load extra device drivers.
In Vista and +, the Volume Boot Record is the Windows Boot Manager. The file corresponding is BOOTMGR.
Windows Boot Manager (BOOTMGR) is a small piece of software, called a boot manager, that's loaded from 
the volume boot code, part of the volume boot record.
BOOTMGR eventually executes winload.exe, the system loader used to continue the Windows boot process.

Windows Boot Manager (BOOTMGR) and Boot Configuration Data (BCD) :
------------------------------------------------------------------
Windows Boot Manager (BOOTMGR, ie Bootmgr.exe or Bootmgr.efi) is a small piece of software, called a boot manager,
that's loaded from the volume boot code, part of the volume boot record.
Configuration data required for BOOTMGR can be found in the Boot Configuration Data (BCD) store, 
a registry-like database that replaced the boot.ini file used in older versions of Windows like Windows XP.
The BOOTMGR file itself is both read-only and hidden and is located in the root directory of the partition 
marked as Active in Disk Management. On most Windows computers, this partition is labeled as System 
Reserved and does not have a drive letter.
If you don't have a System Reserved partition, BOOTMGR is probably located on your primary drive, usually C:.
More details :
--------------
The functionality that was previously combined in Ntldr.exe is now separated into multiple applications :
- Windows Boot Manager (Bootmgr.exe or Bootmgr.efi). This application is independent of the operating system 
  and uses the firmware to load the Windows boot loader either from a particular disk partition or over a 
  network connection (in the case of network boot).
- Windows Boot Loader (Winload.exe or Winload.efi). This application is part of the operating system and 
  loads a specific version of Windows. It uses the firmware to load the operating system kernel and to boot 
  critical device drivers from a local hard disk.
- Windows Resume (Winresume.exe or Winresume.efi). Windows Resume finds a hibernation image and then uses 
  the firmware to read the hibernation file into RAM and to resume the operating system from the hibernation state
For Windows Vista and +, the boot sector loads the Windows Boot Manager (a file named BOOTMGR on either the 
system or the boot partition), accesses the Boot Configuration Data store (BCD) and uses the information 
to load the operating system.
Boot Configuration Data (BCD) is a firmware-independent database for boot-time configuration data. 
It is used by Microsoft's new Windows Boot Manager and replaces the boot.ini that was used by NTLDR.
Boot Configuration Data are stored in a data file that has the same format as the Windows Registry 
hives and is eventually loaded at registry key [HKEY_LOCAL_MACHINE\BCD00000]. The file is located 
either on the EFI System Partition (on machines that use Extensible Firmware Interface firmware) or 
in \Boot\Bcd on the system volume (on machines that use IBM PC compatible firmware).
Boot Configuration Data may be altered using a command-line tool (bcdedit.exe), using Registry 
Editor (regedit.exe), using Windows Management Instrumentation, or with third-party tools such as 
EasyBCD, BOOTICE, or Visual BCD Editor.
Boot Configuration Data contain the menu entries that are presented by the Windows Boot Manager, 
just as boot.ini contained the menu entries that were presented by NTLDR. These menu entries can include:
- Options to boot Windows Vista by invoking winload.exe.
- Options to resume Windows Vista from hibernation by invoking winresume.exe.
- Options to boot a prior version of the Windows NT family by invoking its NTLDR.
- Options to load and to execute a volume boot record.
winload.exe :
-------------
The operating system boot loader in Vista and +  is called winload.exe (which replace NTLDR in older 
version), and is invoked by Windows Boot Manager.
The Windows Boot Manager invokes winload.exe. The operating system boot loader. To load the operating 
system kernel executive (ntoskrnl.exe) and core device drivers. In that respect, winload.exe is 
functionally equivalent to the operating system loader function of NTLDR in prior versions of Windows NT.
NB : A boot loader is a computer program that loads an operating system or some other software for the 
     computer after completion of the self-tests.
REMARQUE sur la partition de boot :
===================================
The 100 MB System Reserved partition is used for the Boot Manager code, BCD (Boot Configuration Database),
System Recovery Options (Windows RE), and start up files for BitLocker (if turned on).
If you want to have the 100 MB System Reserved partition in addition to the Windows 7 C: partition on a HDD 
or SSD after installation, then you would need to make sure that all partitions on the drive have been 
deleted until it is only unallocated space. Next, select the unallocated drive to install Windows 7 on. 
If there are no partitions on the disk, you will get the 100 MB System Reserved.
If you do not want to have the 100 MB System Reserved partition and only the Windows 7 C: partition on a HDD
or SSD after installation, then select a formatted partition or drive to install Windows 7 on. If there are 
any partitions on the disk, you won't get the 100 MB System Reserved.
######################################################################################################
###### TOOLS  :  #####################################################################################
######################################################################################################
BOOTCFG.EXE (obsolete)
--> BootCfg.exe is a tool to configure for boot.ini
--> Applies To: Windows 8, Windows Server 2008, Windows Server 2012, Windows Vista
--> Configures, queries, or changes Boot.ini file settings.
--> The bootcfg command is a Microsoft Windows Server 2003 utility that modifies the 
   Boot.ini file. This command has a function that can scan your computer's hard disks 
   for Microsoft Windows NT, Microsoft Windows 2000, Microsoft Windows XP, and Windows 
   Server 2003 installations, and then add them to an existing Boot.ini file or rebuild *
   a new Boot.ini file if one does not exist. You can use the bootcfg command to add 
   additional Boot.ini file parameters to existing or new entries.
BOOTREC.EXE (replace Bootcfg for system with BCD)
--> If just want to fix the boot problem, BootRec.exe maybe is the easiest way.
--> Remplace désormais Bootcfg car plus de boot.ini mais BCD (Boot Configuration Data)
NB : Boot Configuration Data (BCD) is a firmware-independent database for boot-time 
configuration data. It is used by Microsoft's new Windows Boot Manager and 
replaces the boot.ini that was used by NTLDR.
BCDBOOT.EXE
--> if just want fix BCD itself, try Bcdboot.exe, it has less steps than BCDEDIT. 
BCDEDIT 
--> Used to fix BCB pb. BcdEdit.exe has more options to customize BCD than BCDBOOT.EXE
BOOTSECT.EXE
--> is a tool to fix boot sector for MBR disk. It won't work for GPT disk.

######################################################################################################
###### BOOTREC  :  Boot Recovery tool ################################################################
######################################################################################################
Repairs critical disk structures. The following commands are supported:
 /FixMbr - writes the master boot record of the system partition using the master boot record compatible with Windows. This operation does not overwrite the existing partition table.
 /FixBoot - write a new boot sector onto the system partition using the boot sector compatible with Windows.
 /ScanOs - scan all disks for installations compatible with Windows and display the entries that are currently not in the boot configuration store.
 /RebuildBcd - scan all disks for installations compatible with Windows and allow the user to choose which to add to the boot configuration store.

######################################################################################################
###### BCDBOOT  :  Bcd boot file creation and repair tool ############################################
######################################################################################################
The bcdboot.exe command-line tool is used to copy critical boot files to the system partition and
to create a new system BCD store.
bcdboot [/l ] [/s [/f ]] [/v] [/m [{OS Loader ID}]] [/addlast]
source Specifies the location of the windows system root.
 /l - Specifies an optional locale parameter to use when initializing the BCD store. 
The default is US English.
 /s - Specifies an optional volume letter parameter to designate the target system partition where boot 
environment files are copied. The default is the system partition identified by the firmware.
 /v - Enables verbose mode.
 /m - If an OS loader GUID is provided, this option merges the given loader object with the system 
template to produce a bootable entry. Otherwise, only global objects are merged.
 /d - Specifies that the existing default windows boot entry should be preserved.
 /f - Used with the /s command, specifies the firmware type of the target system partition. 
Options for are 'UEFI', 'BIOS', or 'ALL'.
 /addlast - Specifies that the windows boot manager firmware entry should be added last. 
The default behavior is to add it first.
Examples: bcdboot c:\windows /l en-us
 bcdboot c:\windows /s h:
 sel
 bcdboot c:\windows /m {d58d10c6-df53-11dc-878f-00064f4f4e08}
 bcdboot c:\windows /d /addlast

######################################################################################################
###### BOOTSECT  :  Boot sector restoration tool #####################################################
######################################################################################################

 bootsect {/help|/nt60|/nt52} {SYS|ALL|:} [/force] [/mbr]
Bootsect.exe updates the master boot code for hard disk partitions in order to switch between BOOTMGR 
and NTLDR. You can use this tool to restore the boot sector on your computer.
######################################################################################################
###### BCDEDIT – Boot Configuration Data Store Editor ################################################
######################################################################################################
The Bcdedit.exe command-line tool modifies the boot configuration data store. The boot configuration 
data store contains boot configuration parameters and controls how the operating system is booted. 
These parameters were previously in the Boot.ini file (in BIOS-based operating systems) or in the 
nonvolatile RAM entries (in Extensible Firmware Interface-based operating systems). You can use 
Bcdedit.exe to add, delete, edit, and append entries in the boot configuration data store.
For detailed command and option information, type bcdedit.exe /? . 
For example, to display detailed information about the /createstore command, type:
bcdedit.exe /? /createstore

######################################################################################################
###### RECIMG : changer la référence source WIM  #####################################################
######################################################################################################
Windows 8 - 8.1  : Créer une image PC -- recimg -createImage J:\RefreshImage\PCPGX05   --> cela crée 
une image de type CustomRefresh.WIM du PC
Cette image devient automatiquement la référence  en cas de déclanchement d'opération d'actualisation *
ultérieur du PC
Si l'image doit être déplacée vers un autre répertoire, il faudra  après déplacement 
taper la commande suivante :
recimg /setcurrent <répertoire>
Pour voir le chemin de l'image courante, taper :
recimg /showcurrent
#######################################################################################################
######## Creer un disque de boot externe (ex: clé USB) : ##############################################
#######################################################################################################
Cas n° 1 - Creer un disque USB d'installation de Windows 8  (ex : clé USB ) pour plate-forme BIOS :
===================================================================================================
Attention : il s'agit ici de préparer un  disque pour plate-forme BIOS (pas valable pour plate-forme 
UEFI qui nécéssite une partition Fat32 pour le boot !!)
IMPORTANT :
Dans l'exemple à suivre (cas n° 1), une clé USB avec la distribution Windows 8 va être créée, ce qui permet 
ensuite d'installer Windo<ws 8 directement en bootant à partir de la clé (plutôt qu'à partir d'un DVD par 
exemple). Il est bien sûr possible de suivre une procédure similaire pour faire une clé type réparation
urgence ou type Windows PE, ou alors suivre  l'une des procédures que nous verrons pour les cas n°2 (pour
Windows 8) ou n°3 (cas de Windows 7) !!!

IMPORTANT : Il faut le répertoire ESD de Windows 8 (ou 7) sous C:\ - Sinon, celui-ci se trouve
dans le DVD ou l'ISO d'installation de Windows 8
Aussi, au préalable, télécharger l'ISO de Windows 8 et le monter pour acceder aux fichiers - 
Sinon, pour un PC déjà installé, la distrib se trouve normalement sous C:\ESD\Windows

Step 1 : Mount the Windows 8 ISO image on your computer
Step 2 : Format a USB flash drive
Microsoft Windows [version 6.3.9600]
(c) 2013 Microsoft Corporation. Tous droits réservés.
C:\WINDOWS\system32>e:
E:\>c:
C:\Windows\System32>diskpart
Microsoft DiskPart version 6.3.9600
Copyright (C) 1999-2013 Microsoft Corporation.
Sur l'ordinateur : PCPGX05
DISKPART> list disk
  N° disque  Statut         Taille   Libre    Dyn  GPT
  ---------  -------------  -------  -------  ---  ---
  Disque 0    En ligne        149 G octets      0 octets
  Disque 1    En ligne       3900 M octets      0 octets
DISKPART> select disk 1
Le disque 1 est maintenant le disque sélectionné.
DISKPART> clean
DiskPart a réussi à nettoyer le disque.
DISKPART> create partition primary
DiskPart a réussi à créer la partition spécifiée.
DISKPART> select partition 1
La partition 1 est maintenant la partition sélectionnée.
DISKPART> active
DiskPart a indiqué la partition actuelle comme étant active.
DISKPART> format FS=ntfs
  100 pour cent effectués
DiskPart a formaté le volume.
DISKPART> assign
DiskPart a correctement assigné la lettre de lecteur ou le point de montage.
DISKPART> exit

Step 3: Make the USB flash drive bootable
1.Start a Command Prompt as an Administrator and CHDIR into the boot folder of the Windows 8 ISO image, 
e.g. I:\boot where I:\ is the drive where the ISO image is mounted 
2.Type bootsect /nt60 E:
/* where E: is the drive assigned to the USB flash drive */ 
Par exemple :
Considérons ici que le répertoire ESD est présent sur le PC installé (sinon, monter l'ISO de Windows 8
et adapter le chemin ci-dessous en fonctiuon de la lettre de lecteur du fichier ISO monté) :
C:\Windows\System32>cd C:\ESD\Windows\boot
Si on fait DIR sou C:\ESD\Windows\boot, on trouve le fichier Bootsect.exe que l'on va utiliser maintenant :
C:\ESD\Windows\boot>bootsect /nt60 F:
Target volumes will be updated with BOOTMGR compatible bootcode.
F: (\\?\Volume{75f6a3a5-76fd-11e3-be9b-001ec9008c34})
    Successfully updated NTFS filesystem bootcode.
Bootcode was successfully updated on all targeted volumes.
C:\ESD\Windows\boot>

Step 4: Copy the Windows 8 files onto the USB flash drive
From a command line, use XCOPY to copy the Windows 8 files to the USB flash drive . In the example below, 
I:\ is the drive where the ISO image is mounted. F:\ is the USB flash drive.
XCOPY C:\ESD\Windows\*.* F:\ /E /F /H
Step 5: Install Windows 8 from the bootable flash drive
Finally, follow these instructions to install Windows 8 on your computer.
1.Remove your USB flash drive from your "source" computer and insert it into the "target" computer 
  where you want to install Windows 8 
2.On the computer where you are installing Windows 8, press the power button to turn on the computer 
3.During boot up, select the USB flash drive to boot from (if you don't see the USB flash drive as an 
  option, you may have to adjust your BIOS settings) 
4.Follow the instructions to install Windows 8 Developer Preview 
Cas n° 2 - Créer un disque USB de boot WIN PE Windows 8 :
=========================================================
REMARQUE IMPORTANTE : si on suit la procédure jusqu'au bout, on peutr ausssi de cette façon faire un disque
d'installation de Windows 8 (ie boot sur WIN PE et ajout d'une image Windows 8) - C'est donc une variante
du cas n°1 mais qui pourrait permettre poar exemple d'installer une image customizée de Windows 8 !!!
Cette fois valable aussi pour plate-foreme UEFI (car partition de boot en FAT32)
Applies To: Windows 8, Windows 8.1, Windows Server 2012, Windows Server 2012 R2
Remarque : The default installation runs from memory (RAM disk), so you can remove 
  the drive while Windows PE is running.
1 - Install the Windows ADK :
-----------------------------
Install the following features from the Windows Assessment and Deployment Kit (Windows ADK):
 - Deployment Tools: includes the Deployment and Imaging Tools Environment.
 - Windows Preinstallation Environment : includes the files used to install Windows PE.
2 - Install Windows PE :
------------------------
 - Start the Deployment and Imaging Tools Environment as an administrator.
 - Create a working copy of the Windows PE files. Specify either x86, amd64, or arm. Exemple :
copype amd64 C:\WinPE_amd64
 - Install Windows PE to the USB flash drive, specifying the drive letter- Exemple :
MakeWinPEMedia /UFD C:\WinPE_amd64 F:
3 - Boot to Windows PE :
------------------------
 - Connect the USB device to the PC you want to work on.
 - Turn on the PC, and press the key that opens the firmware boot menus.
 - Select the USB drive. Windows PE starts automatically.
After the command window appears, the wpeinit command runs, which sets up the system. 
This might take a few minutes.
4 - Troubleshooting :
---------------------
 - If the copype command isn't recognized, make sure you're running the command from the Deployment 
and Imaging Tools Environment, which is part of the Windows ADK.
 - If Windows PE doesn't appear, try the following workarounds, rebooting the PC each time :
- To boot a PC that supports UEFI mode, in the firmware boot menus, try manually 
 selecting the boot files: \EFI\BOOT\BOOTX64.EFI.
- Try a different USB port. Avoid hubs or cables.
- Avoid USB 3.0 ports if the firmware doesn't contain native support for USB 3.0.
- Clean the USB flash drive, and then reinstall Windows PE. This can help remove extra boot partitions or other boot software.
diskpart
  list disk
  select disk <disk number>
  clean
  create partition primary
  format quick fs=fat32 label="Windows PE"
  assign letter="F"
  exit
MakeWinPEMedia /UFD C:\winpe_amd64 F:
- Try booting Windows PE from a DVD instead. Create an ISO file that you can burn onto a DVD:
MakeWinPEMedia /ISO C:\winpe_amd64 c:\winpe_amd64\winpe.iso
In File Explorer, navigate to C:\winpe_amd64, right-click winpe.iso, and select 
Burn to disc. Follow the prompts to create a DVD.
- If your PC requires storage or video drivers to boot, try adding those same drivers to the 
 Windows PE image.
- Update the firmware of the PC to the latest version.
- If the PC doesn't connect to network locations, see :
   WinPE Network Drivers: Initializing and adding drivers ( http://technet.microsoft.com/en-us/library/hh824935.aspx)
5 - If you want to store Windows Images on the Windows PE Drive :
-----------------------------------------------------------------
 - Typically you won't be able to store or capture Windows images on a Windows PE USB flash drive.
Most USB flash drives support only a single drive partition. The MakeWinPEMedia command 
formats the drive as FAT32, which supports booting both BIOS-based and UEFI-based PCs. This 
file format only supports file sizes up to 4 GB.
 - For external USB hard drives, you can create a separate NTFS partition that can handle larger file sizes:
diskpart
  list disk
  select <disk number>
  clean
  rem === Create the Windows PE partition. ===
  create partition primary size=2000
  format quick fs=fat32 label="Windows PE"
  assign letter=P
  active
  rem === Create a data partition. ===
  create partition primary
  format fs=ntfs quick label="Other files"
  assign letter=O
  list vol
  exit
MakeWinPEMedia /UFD C:\WinPE_amd64 P:

Cas n° 3 - Créer un disque USB de boot WIN PE Windows 7 :
=========================================================
S'applique à: Windows 7, Windows Server 2008 R2
Cette démonstration vous explique comment créer un disque virtuel Windows® PE démarrable sur un 
disque mémoire flash USB à l’aide du script Copype.cmd. 
La mémoire vive de Windows PE vous permet de démarrer un ordinateur à des fins de déploiement 
ou de récupération. La mémoire vive de Windows PE démarre directement en mémoire, vous permettant 
ainsi de supprimer le support Windows PE après le démarrage de l’ordinateur.
Cette configuration démarre directement en mémoire et la lettre de lecteur X lui est affectée, 
qui ne correspond pas au support (clé USB, CD-ROM) à partir duquel vous avez démarré. 
Vous pouvez définir la lettre de lecteur à l’aide de l’option DISM /Set-TargetPath. 
Vérifiez que vous disposez d’une quantité de mémoire suffisante pour la prise en charge de la 
taille de votre image système Windows PE et pour tous les besoins en mémoire supplémentaires, 
par exemple si vous prévoyez d’exécuter des applications personnalisées nécessitant 
une mémoire de travail complémentaire.
Conditions préalables :
-----------------------
Pour terminer cette démonstration, vous avez besoin des éléments suivants :
 - Un ordinateur de référence contenant tous les outils et fichiers sources.
 - Un accès à un ordinateur exécutant une session Windows 7 ou Windows PE.
 - Un disque mémoire flash USB. La taille du disque mémoire flash USB doit 
   être supérieure d’au moins 64 mégaoctets (Mo) à la taille de votre image 
   système Windows PE et des éventuels fichiers supplémentaires que vous incluez.
Étape 1 - Configurer un environnement de construction Windows PE :
------------------------------------------------------------------
Dans cette étape, vous créez une structure de répertoires requise qui prend en 
charge la création d’une image de Windows PE.
1. Sur votre ordinateur de référence, cliquez sur Démarrer, pointez sur 
  Tous les programmes, pointez sur Windows OPK ou sur Windows AIK, 
  cliquez avec le bouton droit sur Invite de commande des outils de déploiement, 
  puis sélectionnez Exécuter en tant qu’administrateur.
    Le raccourci de menu ouvre une fenêtre d’invite de commandes et définit automatiquement 
  les variables d’environnement pour qu’elles pointent vers les outils nécessaires. 
  Par défaut, tous les outils sont installés à l’emplacement C:\Program Files\<kit>\Tools,
  où <kit> peut être Windows OPK ou Windows AIK.
2. À l’invite de commandes, exécutez le script Copype.cmd. Le script nécessite 
  deux arguments : l’architecture matérielle et l’emplacement de destination.
copype.cmd <arch> <destination>
où <arch> peut être x86, amd64 ou ia64 et où <destination> est 
un chemin d’accès vers un répertoire local. 
Exemple : copype.cmd x86 c:\winpe_x86
L’exécution du script entraîne la création de la structure de répertoires suivante 
et la copie tous les fichiers nécessaires pour cette architecture. 
Par exemple :
\Winpe_x86
\Winpe_x86\ISO
\Winpe_x86\Mount
3. Copiez l’image de base (Winpe.wim) dans le dossier \Winpe_x86\ISO\sources et 
  renommez le fichier en Boot.wim :
copy c:\winpe_x86\winpe.wim c:\winpe_x86\ISO\sources\boot.wim
Étape 2 - Ajouter des personnalisations supplémentaires :
---------------------------------------------------------
Cette étape est facultative mais recommandée.
Vous pouvez utiliser ImageX pour ajouter des applications et des scripts à votre image système 
Windows PE dont vous pouvez avoir besoin dans Windows PE. ImageX est un outil permettant de 
capturer et d’appliquer des images dans le cadre de scénarios de déploiement. Par exemple, entrez 
la commande suivante pour copier l’outil ImageX vers l’image système Windows PE.
copy "c:\program files\<version>\Tools\x86\ImageX.exe" c:\winpe_x86\iso\
Étape 3 - préparer le disque mémoire flash USB :
------------------------------------------------
Avant de pouvoir placer Windows PE sur un disque mémoire flash USB, vous devez formater celui-ci 
à l’aide d’une version de DiskPart provenant de Microsoft Vista, Windows 7 ou Windows PE 2.0 ou supérieur.
1. À partir d’une session Windows PE ou d’un système d’exploitation valide en cours d’exécution, 
  insérez votre disque mémoire flash USB.
2. À l’invite de commandes, utilisez Diskpart pour formater le disque mémoire flash USB 
  entièrement en FAT32 et activez la partition. 
  Par exemple,
Diskpart
select disk 1
clean
create partition primary
select partition 1
active
format quick fs=fat32
assign
exit
Dans l’exemple ci-dessus, on suppose que disk 1 correspond à la clé USB.
3. Sur l’ordinateur de référence, copiez tout le contenu du répertoire \ISO sur votre disque 
  mémoire flash USB. Vous pouvez créer manuellement la structure de répertoires ou utiliser 
  la commande xcopy pour créer et copier automatiquement les fichiers appropriés depuis votre 
  ordinateur de référence vers votre disque mémoire flash USB. Par exemple,
xcopy C:\winpe_x86\iso\*.* /e F:\
où C représente la lettre du disque dur de l’ordinateur de référence 
et F la lettre du disque mémoire flash USB.
Vous pouvez également placer le disque virtuel Windows PE sur un autre support démarrable, 
par exemple un CD-ROM ou un disque dur. 
Pour charger une application ou un script en mémoire sous Windows PE, vous devez créer 
une image personnalisée de Windows PE.
Cas n° 4 - Windows 8.1 - via GUI :
==================================
Depuis Windows 8.1 il n'est plus possible de créer un CD de récupération "disque de réparation système". 
A la place Windows propose de créer un "lecteur de récupération". Il s'agit d'une clé USB permettant d'accéder 
à diverses options de dépannage lorsque le démarrage ou le système n'est plus accessible.
1 - Pour créer la clé USB de secours bootable, faites apparaitre l'option "Créer un lecteur de récupération" 
en passant par la recherche Windows ou via le panneau de configuration (applet system ou historiques des fichiers):
2 - Lancer l'assistant de création. Si vous possédez une partition de récupération mise en place par le fabricant 
de l'ordinateur Windows propose de l'exporter en cochant l'option.
3 - Insérez une clé dans un des ports USB. 512 Mo suffisent dans le cas d'une création d'une clé de réparation 
simple, il faudra viser plus gros si vous exportez la partition du fabricant :
Windows 8.1 vous informe que tout le contenu de la clé va être effacé.
Votre clé de réparation est à présent créée. Pour l'utiliser si votre système est en panne, vous devrez booter 
dessus en modifiant l'ordre de boot, les options de réparation seront ainsi accessibles.
Important : la procédure de réparation vous demandera peut-être un support (le CD original de Windows). 
*Il est donc prudent de réaliser également une image système de Windows 

#######################################################################################################
###### BCDEDIT : Build a Bootable BCD from Scratch with Bcdedit #######################################
#######################################################################################################
Manipulate the Boot Configuration Data file :
---------------------------------------------
Once Bootmgr starts up, though, it needs some marching orders, and it gets those from a binary 
file called the Boot Configuration Data (BCD) file , which usually lives in a folder 
named \boot on the active partition. You use Bcdedit to configure the BCD file. 
A working BCD file typically contains at least two objects. First, it has a Boot Manager, 
which contains overall boot information such as which OS entry to boot by default and the 
amount of seconds to wait for the user if more than one OS entry exists. Second, it contains 
at least one OS entry. Here’s how to create them.
Start by deleting any existing BCD files and creating a new empty BCD file. Bcdedit requires 
you to first create a new BCD file somewhere and then “import” it  (a process that 
copies whatever is in the new BCD file into the “official” BCD file in \boot on the active 
volume). You can do that by typing two commands into an elevated command prompt:

bcdedit /createstore bcd
bcdedit /import bcd
These commands work whether you already have a \boot\bcd in place or if you’re working 
from a toasted boot volume that lacks any BCD file at all. Now that you’ve done that, the 
“sacrificial" BCD file is no longer necessary, so you can delete it:
del bcd
Next, create the Boot Manager piece of the BCD file by typing
bcdedit /create {bootmgr}
Note the /create option in this command instead of the /createstore option in the earlier
command. You’ll use the former quite often in BCD work and the latter much less so. 
The /create option lets Bcdedit create several different kinds of BCD objects. 
Invoking it with the {bootmgr} identifier creates that overall Boot Manager section. 
(Note that I haven't included a description with the /d option, despite the fact that every
example I can find on the Web does. It’s superfluous when creating a Boot Manager object.)
The Boot Manager doesn’t need much tweaking, but it does need to know what volume to boot 
from and how many seconds to wait for a user to choose an OS option. These options will 
work fine:
bcdedit /set {bootmgr} device boot
  bcdedit /timeout 30
Next, create the OS entry object that will tell the Boot Manager to boot Windows from 
files in the \Windows folder on one of the system’s volumes. That volume is usually C, 
but if you’re booted from Windows Preinstallation Environment (WinPE), double-check 
which drive has the \Windows folder on it—WinPE might see it as D or E. 
(That’ll be important in a minute.)
Now, create the OS entry object:
bcdedit /create /d "Windows 7" /application osloader
The /create option (without an ID) and the /application osloader option tell Windows 
that you’re creating an OS entry for a Vista-and-later version of Windows. 
(The /d option contains the label that Boot Manager shows when offering multiple OS 
entries.) That returns a new GUID that you should plug into this next command:
bcdedit /default {<GUID>}
At this point, you’ve got a naked object that needs some values with the Bcdedit /set 
command that I introduced in earlier Bcdedit columns, but what to set those values 
to? Simple! Look at the output of Bcdedit on a healthy copy of Windows, and use it 
as a model. In my case, the \Windows folder is on drive D, so I entered these:
bcdedit /set {default} device partition=d:
Ensuite, soit :
bcdedit /set {default} path \windows\system32\boot\winload.exe
Soit :
bcdedit /set {default} path \windows\system32\winload.efi
Puis :
bcdedit /set {default} osdevice partition=d:
bcdedit /set {default} systemroot \Windows
bcdedit /set {default} detecthal yes
Ajouter aussi eventuellement :
bcdedit /set {default} locale en-us 
  ou bcdedit /set {default} locale fr-fr
bcdedit /set {default} recoverysequence {GUID of recovery partition}
bcdedit /set {default} recoveryenabled yes
bcdedit /set {default} bootmenupolicy Legacy
Finally, add this command, or Windows won’t see the OS entry properly:
bcdedit /displayorder {default} /addlast*

Give this a try with a test machine or two, and you’ll be Doctor Boot in no time!

REMARQUE : "The 100 MB System Reserved partition is used for the Boot Manager code,
BCD (Boot Configuration Database), System Recovery Options (Windows RE), and start 
up files for BitLocker (if turned on).
If you want to have the 100 MB System Reserved partition in addition to the Windows 7 
C: partition on a HDD or SSD after installation, then you would need to make sure that 
all partitions on the drive have been deleted until it is only unallocated space. Next,
select the unallocated drive to install Windows 7 on. If there are no partitions on the
disk, you will get the 100 MB System Reserved.
If you do not want to have the 100 MB System Reserved partition and only the Windows 7
C: partition on a HDD or SSD after installation, then select a formatted partition or 
drive to install Windows 7 on. If there are any partitions on the disk, you won't get 
the 100 MB System Reserved."
so, if you install windows to an EMPTY drive (unallocated space), a system partition (100 Mb)
will be created, containing BCD info.... is this a precaution, a precursor to windows 7's
"bcd in boot" configuration (illustrated above), or the non-virtualized way of doing things?
I'm still trying to go native vhd on barebones, having suffered a boot failure with my win7 vhd.... 
trying to understand what to do following the 'clean disk' operation 
Originally scott's guide seemed logical, but having suffered boot issues, I want to protect 
myself from a repeat, and ideal avoid an windows/software reinstall (this is the land 
of V-OS after all!!)!
 http://www.hanselman.com/blog

#######################################################################################################
----------- BCDEDIT : Sauvegarde env de boot : ----------------------------------------------------
#######################################################################################################
Backup de l'environnement de démarrage :
bcdedit /export c:\ExportBCD

#######################################################################################################
----------- BCDEDIT : Ajout de nouvelles entrées au menu de boot  : --------------------------------
#######################################################################################################
Exemple 1 - Pour copier une entrée pour permettre de la modifier ensuite avec des paramètres différents :
Création de 'entrée :
bcdedit /copy {current} /d "Windows 8 - boot en mode VGA"
Pour modifier le description de l'entrée :
bcdedit /set  {03b5b7fc-0b6f-11df-bbe1-fb504b164c86} description  "Windows 8.1 - boot en mode VGA"
Pour configurer le mode de démarrage en VGA :
bcdedit /set {03b5b7fc-0b6f-11df-bbe1-fb504b164c86} vga yes
Exemple 2 - Pour créer une entrée supplémentaire de boot en mode sans echec (Safeboot) :
Création de 'entrée :
bcdedit /copy {current} /d "Windows 8.1 - boot en Safe Mode"
Récupérer l'identificateur de la nouvelle entrée :
bcdedit
Modifier l'entrée comme suit :
bcdedit /set {03b5b7fd-0b6f-11df-bbe1-fb504b164c86} safeboot minimal
Résultat pour les 2 exemples :
------------------------------
C:\WINDOWS\system32>bcdedit
Gestionnaire de démarrage Windows
---------------------------------
identificateur          {bootmgr}
device                  partition=\Device\HarddiskVolume1
description             Windows Boot Manager
locale                  fr-FR
inherit                 {globalsettings}
integrityservices       Enable
default                 {current}
resumeobject            {03b5b7f8-0b6f-11df-bbe1-fb504b164c86}
displayorder            {current}
                        {63011fbf-f00f-11dc-a407-e68640d7d6f2}
                        {03b5b7fc-0b6f-11df-bbe1-fb504b164c86}
                        {03b5b7fd-0b6f-11df-bbe1-fb504b164c86}
toolsdisplayorder       {memdiag}
timeout                 5
displaybootmenu         Yes
Chargeur de démarrage Windows
-----------------------------
identificateur          {current}
device                  partition=C:
path                    \WINDOWS\system32\winload.exe
description             Windows 8.1
locale                  fr-FR
inherit                 {bootloadersettings}
recoverysequence        {03b5b7fa-0b6f-11df-bbe1-fb504b164c86}
integrityservices       Enable
recoveryenabled         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \WINDOWS
resumeobject            {03b5b7f8-0b6f-11df-bbe1-fb504b164c86}
nx                      OptIn
bootmenupolicy          Standard
Chargeur de démarrage Windows
-----------------------------
identificateur          {03b5b7fc-0b6f-11df-bbe1-fb504b164c86}
device                  partition=C:
path                    \WINDOWS\system32\winload.exe
description             Windows 8.1 - boot en mode VGA
locale                  fr-FR
inherit                 {bootloadersettings}
recoverysequence        {03b5b7fa-0b6f-11df-bbe1-fb504b164c86}
integrityservices       Enable
recoveryenabled         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \WINDOWS
resumeobject            {03b5b7f8-0b6f-11df-bbe1-fb504b164c86}
nx                      OptIn
bootmenupolicy          Standard
vga                     Yes
Chargeur de démarrage Windows
-----------------------------
identificateur          {03b5b7fd-0b6f-11df-bbe1-fb504b164c86}
device                  partition=C:
path                    \WINDOWS\system32\winload.exe
description             Windows 8.1 - boot en Safe Mode
locale                  fr-FR
inherit                 {bootloadersettings}
recoverysequence        {03b5b7fa-0b6f-11df-bbe1-fb504b164c86}
integrityservices       Enable
recoveryenabled         Yes
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \WINDOWS
resumeobject            {03b5b7f8-0b6f-11df-bbe1-fb504b164c86}
nx                      OptIn
safeboot                Minimal
bootmenupolicy          Standard
C:\WINDOWS\system32>
#######################################################################################################
----------- BCDEDIT : Modification menu de boot -------------------------------------------------------
#######################################################################################################

Sous Windows 8 et 8.1 : retrouver le mode sans échec :
Lancer :
bcdedit /set {bootmgr} displaybootmenu yes
Pour changer le temps pendant lequel le menu est afficher, utiliser MSCONFIG et son onglet Demarrer
Exemple :
C:\WINDOWS\system32>bcdedit /set {bootmgr} displaybootmenu yes
L'opération a réussi.
C:\WINDOWS\system32>msconfig
C:\WINDOWS\system32>
Autre soluce (non testé par moi mais sensé être OK avec W8, W8.1 et UEFI):
Taper >  bcdedit /set bootmenupolicy Legacy
 Ceci permet d'utiliser la touche F8 comme avant

Lancer le serveur en mode de restauration Active Directory (équivalent touche F8 au boot) :
bcedit /set safeboot dsrepair 
Lancer le serveur en mode Safe Mode: 
bcdedit /set {default} safeboot minimal 
Lancer le serveur en mode Safe Mode with Networking: 
bcdedit /set {default} safeboot network 
Lancer le serveur en mode Safe Mode with Command Prompt: 
bcdedit /set {default} safeboot minimal bcdedit
set {default} safebootalternateshell yes
#######################################################################################################
--- Réparation secteur d'amorce et boot ---------------------------------------------------------------
#######################################################################################################


Méthode 1  :
============
Cas où l'OS est normalement présent sous C:\Windows et les fichiers de boot sous C:\boot (et donc pas
dans la partition Reserved) - Disque MBR
Bcdedit /export C:\BCD_Backup
# Seconde sauvegarde (ceinture/bretelles)
ren c:\boot\bcd bcd.old
Bootrec /rebuildbcd
bcdboot.exe c:\windows /s c:
ou
bcdboot.exe c:\windows
Voir en tapant bcdedit
C:>cd c:\ESD\Windows\boot> 
c:\ESD\Windows\boot>bootsect /nt60 C:
Rebooter

Méthode 2  :
============
Cas où l'OS est normalement présent sous C:\Windows et les fichiers de boot sont dans la partition 
"System Reserved" (disque Basic - Boot MBR) ou dans la partition FAT32 de 99 Mb (disque GPT - boot EFI)

# CAS 1 : boot de type MBR :
# Il existe alors une partition NTFS "System reserved" de 350 Mb (boot MBR)
# Vérifier qu'elle est monté et noter sa lettre de lecteur via DISKPART 
# Noter aussi la letrre de la partition OS (sera nécessaire plus bas pour BCDBOOT) :
X:\Sources> Dispart
  Diskpart> list disk
  Diskpart> select disk 0
  Diskpart> list volume
# Par exemple la partition reserved a la lettre C:
# Remarquer qu'il n'y a pas de répertoire EFI sous C:\ mais un répertoire boot
# Voir le fichier BCD :
X:\Sources> dir /a c:\boot
Bcdedit /export C:\BCD_Backup
# Seconde sauvegarde (ceinture/bretelles) 
X:\Sources> attrib -h -r -s c:\boot\BCD 
X:\Sources> ren C:\Boot\BCD BCD.old
# Cas où partition reserved = C: - la partition OS est alors D: (vérifier avec diskpart)
X:\Sources> bcdboot.exe d:\windows /s c:
ou bien X:\Sources> bcdboot.exe d:\windows  (voir lequel marche !)
Voir en tapant :
X:\Sources> bcdedit
Si nécéssaire :
X:\Sources> bootrec /fixmbr
X:\Sources> bootrec /fixboot
Rebooter

# CAS 2 : boot de type EFI :
# Si boot de type EFI, une partition FAT32 de 99 Mb existe et constitue la partition de boot
# Cette poartition n'a pas de lettre de lecteur - Nous devons lui en attruibuer une pour pouvoir
# y accéder :
X:\Sources> Dispart
Diskpart> list disk
  Diskpart> select disk 0
  Diskpart> list volume
  # Localiser soit la partition FAT32 de 99 mb (boot EFI)
  # Par exemple Volume 3
  Diskpart> select volume 3
  # Assigner une lettre de lecteur au volume, par exemple H:
  Diskpart> assign letter = H:
  Diskpart> exit
 
Bcdedit /export C:\BCD_Backup
# Seconde sauvegarde (ceinture/bretelles)
X:\Sources> ren H:\EFI\Windows\Boot\BCD bcd.old
bcdboot.exe c:\windows /s H:
ou bien bcdboot.exe c:\windows  (voir lequel marche !)
Voir en tapant :
X:\Sources> bcdedit
Faire un  Fixboot :
X:\Sources> bootrec /fixboot
Rebooter

Méthode 3 :
===========
Dans l'exemple, la partition de boot est C:\ et la partition OS D:\
Bcdedit /export C:\BCD_Backup
ren c:\boot\bcd bcd.old
Bootrec /rebuildbcd
bcdboot.exe d:\windows /s c:
Voir en tapant bcdedit
Rebooter
######################################################################################################
###### Repair BCD on EFI computer ####################################################################
######################################################################################################
Here's how a fixed it (now knowing that I dealing with EFI Boot Manager):
 Use the iso (above) to create bootable USB
 Used the advanced options to get command prompt up and entered: 
 >DISKPART
 Dispart> list disk
 Dispart> select disk 0
 Dispart> list volume
 # Sur un système UEFI, on doit retrouver une partition FAT32 de 99 MB - C'est kla partition de boot
 # Par défaut, elle n'a pas de lettre de lecteur - Nous allons lui en affecter une pour pouvoir y accèder
 Dispart> select volume 4 {my system volume, see table in 1st post}
 Dispart> assign letter = H:
 Dispart> exit
 {this gave my system volume the the drive letter H:}
 {still in command prompt but no longer in diskpart}
 > H:
 > Dir 
 --> on doit voir un répertoire EFI 
 --> pour tout voir :   dir /a
 > cd EFI
 > cd Microsoft
 > cd Boot 
 > dir B*
  On doit voir le fichier BCD
 > bootrec /fixboot
 > ren BCD BCD.old {rename bcd to bcd.old}*
3 possibilités de reconstruction :
----------------------------------
Soit :
 >bcdboot c:\windows*
Soit
 >bcdboot c:\Windows /l en-us /s H: /f all {rebuild the bcd, I'm using the english US language version ? "/L en-us"}
Soit :
 >bootrec /rebuildbcd
 {i left it running for a few min until i got the operation complete notice}
 >exit



#######################################################################################################
--- Principe des partitions sur disque MBR (plate-forme BIOS) -----------------------------------------
#######################################################################################################

Par défaut, il existe 2 partitions seulement chacune associée à un volume:
 - La partition SYSTEM RESERVED de 350 MB en NTFS - Contient les fichiers de démarrage
   (dont BCD, BOOTMGR, rep BOOT)
 - La partition OS (qui contient Windows) - Le reste du disque en NTFS

C:\Users\Administrator>diskpart
Microsoft DiskPart version 6.3.9600
Copyright (C) 1999-2013 Microsoft Corporation.
On computer: WIN-ENP152OPNO8

DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online           20 GB      0 B

DISKPART> select disk 0
Disk 0 is now the selected disk.

DISKPART> detail disk
Virtual HD ATA Device
Disk ID: 69ECC281
Type   : ATA
Status : Online
Path   : 0
Target : 0
LUN ID : 0
Location Path : ACPI(_SB_)#ACPI(PCI0)#ACPI(IDE0)#ACPI(CHN0)#ATA(C00T00L00)
Current Read-only State : No
Read-only  : No
Boot Disk  : Yes
Pagefile Disk  : Yes
Hibernation File Disk  : No
Crashdump Disk  : Yes
Clustered Disk  : No
  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 1         System Rese  NTFS   Partition    350 MB  Healthy    System
  Volume 2     C                NTFS   Partition     19 GB  Healthy    Boot

DISKPART> list volume
  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     D   IR3_SSS_X64  UDF    DVD-ROM     4331 MB  Healthy
  Volume 1         System Rese  NTFS   Partition    350 MB  Healthy    System
  Volume 2     C                NTFS   Partition     19 GB  Healthy    Boot

DISKPART> list partition
  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Primary            350 MB  1024 KB
  Partition 2    Primary             19 GB   351 MB

DISKPART> select partition 1
Partition 1 is now the selected partition.

DISKPART> detail partition
Partition 1
Type  : 07
Hidden: No
Active: Yes
Offset in Bytes: 1048576
  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 1         System Rese  NTFS   Partition    350 MB  Healthy    System

DISKPART> select partition 2
Partition 2 is now the selected partition.

DISKPART> detail partition
Partition 2
Type  : 07
Hidden: No
Active: No
Offset in Bytes: 368050176
  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 2     C                NTFS   Partition     19 GB  Healthy    Boot

DISKPART>

#######################################################################################################
--- Principe des partitions sur disque GPT (plate-forme UEFI) -----------------------------------------
#######################################################################################################
Par défaut, il existe 4 partitions (mais seulement 3 volumes):
 - La partition RECOVERY de 300  Mb en NTFS
 - La partition EFI (ou ESP, ie EFI System Partition) de 99 MB en FAT32 - Contient les fichiers de démarrage
   (dont BCD, BOOTMGR, rep BOOT et rep EFI)
 - La partition MSR de 128 MB - Pas formattée - donc pas de volume associée
 - La partition OS (qui contient Windows) - Le reste du disque en NTFS
Remarque : noter qu'il est possible pour un système UEFI de booter sur un disque MBR (la norme UEFI impose de 
pouvoir le faire normalement grace au CSM ou Compatibility Support Module mais malheureusement pas toujours 
implémenté ! - Voir plus bas explication sur CSM) - En fait, le premier bloc (secteur) du disque GPT est réservé
à la création d'un LEGACY boot sector, ce qui permet en théorie au systèmes anciens (plate-forme BIOS) de charger en
mémoire le contenu de ce premier secteur et d'éxecuter le code correspondant (principe ses disques MBR) : 
la rétrocompatibilité descendante est ainsi normalement assurée.
Sur un disque GPT, la partition EFI est identifié dans la "GUID Partition Table" par le GUID 
C12A7328-F81F-11D2-BA4B-00A0C93EC93B. Sur un disque MBR, la partition EFI est identifiée dans la 
"MBR partition table" par l'ID 0xEF.
Pour un système purement UEFI avec disque GPT, voici le schéma des partitions :
C:\Windows\system32>diskpart
Microsoft DiskPart version 6.4.9841
Copyright (C) 1999-2013 Microsoft Corporation.
On computer: ARS-W10-01

DISKPART> list disk
  Disk ###  Status         Size     Free     Dyn  Gpt
  --------  -------------  -------  -------  ---  ---
  Disk 0    Online           15 GB      0 B        *

DISKPART> detail disk
Microsoft Virtual Disk
Disk ID: {B5C53D16-372A-42AC-9C29-66D5A5324336}
Type   : SAS
Status : Online
Path   : 0
Target : 0
LUN ID : 0
Location Path : UNAVAILABLE
Current Read-only State : No
Read-only  : No
Boot Disk  : Yes
Pagefile Disk  : Yes
Hibernation File Disk  : No
Crashdump Disk  : Yes
Clustered Disk  : No
  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 1     C                NTFS   Partition     14 GB  Healthy    Boot
  Volume 2         Recovery     NTFS   Partition    300 MB  Healthy    Hidden
  Volume 3                      FAT32  Partition     99 MB  Healthy    System

DISKPART> list volume
  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
  Volume 0     D   JM1_CCSA_X6  UDF    DVD-ROM     3910 MB  Healthy
  Volume 1     C                NTFS   Partition     14 GB  Healthy    Boot
  Volume 2         Recovery     NTFS   Partition    300 MB  Healthy    Hidden
  Volume 3                      FAT32  Partition     99 MB  Healthy    System

DISKPART> select disk 0
Disk 0 is now the selected disk.

DISKPART> list partition
  Partition ###  Type              Size     Offset
  -------------  ----------------  -------  -------
  Partition 1    Recovery           300 MB  1024 KB
  Partition 2    System              99 MB   301 MB
  Partition 3    Reserved           128 MB   400 MB
  Partition 4    Primary             14 GB   528 MB
DISKPART> select partition 1
Partition 1 is now the selected partition.

DISKPART> detail partition
Partition 1
Type    : de94bba4-06d1-4d40-a16a-bfd50179d6ac
Hidden  : Yes
Required: Yes
Attrib  : 0X8000000000000001
Offset in Bytes: 1048576
  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 2         Recovery     NTFS   Partition    300 MB  Healthy    Hidden

DISKPART> select partition 2
Partition 2 is now the selected partition.

DISKPART> detail partition
Partition 2
Type    : c12a7328-f81f-11d2-ba4b-00a0c93ec93b
Hidden  : Yes
Required: No
Attrib  : 0X8000000000000000
Offset in Bytes: 315621376
  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 3                      FAT32  Partition     99 MB  Healthy    System

DISKPART> select partition 3
Partition 3 is now the selected partition.

DISKPART> detail partition
Partition 3
Type    : e3c9e316-0b5c-4db8-817d-f92df00215ae
Hidden  : Yes
Required: No
Attrib  : 0X8000000000000000
Offset in Bytes: 419430400
There is no volume associated with this partition.

DISKPART> select partition 4
Partition 4 is now the selected partition.

DISKPART> detail partition
Partition 4
Type    : ebd0a0a2-b9e5-4433-87c0-68b6b72699c7
Hidden  : No
Required: No
Attrib  : 0000000000000000
Offset in Bytes: 553648128
  Volume ###  Ltr  Label        Fs     Type        Size     Status     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 1     C                NTFS   Partition     14 GB  Healthy    Boot

DISKPART>

Pour INFO - Structure des partitions sur la tablettre surface PRO 3 (ici focus sur la partition Recovery):
----------------------------------------------------------------------------------------------------------
Contenu du fichier $PBR_Diskpart.txt récupéré sous C:\Window<s\Systemz32\Recovery :
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
rem == ResetPartitions-UEFI.txt ==
convert gpt
rem == 1. Windows RE tools partition ===============
create partition primary size=310
format quick fs=ntfs label="Windows RE tools"
assign letter="T"
set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac
gpt attributes=0x8000000000000001
rem == 2. System partition =========================
create partition efi size=100
format quick fs=fat32 label="System"
assign letter="S"
rem == 3. Microsoft Reserved (MSR) partition =======
create partition msr size=128
rem == 4. Windows partition ========================
rem ==    a. Create the Windows partition ==========
create partition primary 
rem ==    b. Create space for the recovery image ===
shrink minimum=5124
rem ==    c. Prepare the Windows partition ========= 
format quick fs=ntfs label="Windows"
assign letter="W"
rem === 5. Recovery image partition ================
create partition primary
format quick fs=ntfs label="Recovery image"
assign letter="R"
set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac
gpt attributes=0x8000000000000001
list volume
exit
Contenu du fichier $PBR_ResetConfig.xml du même répertoire (donc sous C:\Window<s\Systemz32\Recovery) :
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
<?xml version="1.0" encoding="utf-8"?>
<!-- ResetConfig.xml for UEFI -->
<Reset>
<SystemDisk>
<DiskpartScriptPath>$PBR_Diskpart.txt</DiskpartScriptPath>
<MinSize>231988</MinSize>
<WindowsREPartition>1</WindowsREPartition>
<WindowsREPath>Recovery\WindowsRE</WindowsREPath>
<OSPartition>4</OSPartition>
<RecoveryImagePartition>5</RecoveryImagePartition>
<RecoveryImagePath>RecoveryImage</RecoveryImagePath>
<RestoreFromIndex>1</RestoreFromIndex>
<RecoveryImageIndex>1</RecoveryImageIndex>
<WIMBoot>0</WIMBoot>
</SystemDisk>
</Reset>
Confirmation  via Diskpart :
''''''''''''''''''''''''''''
C:\Mes_DATAS\Doss_ISO_VHDs\X64\Oscdimg>diskpart
Microsoft DiskPart version 6.3.9600
Copyright (C) 1999-2013 Microsoft Corporation.
Sur l'ordinateur : ARAGORN
DISKPART> list disk
  N° disque  Statut         Taille   Libre    Dyn  GPT
  ---------  -------------  -------  -------  ---  ---
  Disque 0    En ligne        238 G octets      0 octets        *
DISKPART> select disk 0
Le disque 0 est maintenant le disque sélectionné.
DISKPART> list partition
  N° partition   Type              Taille   Décalage
  -------------  ----------------  -------  --------
  Partition 1    Récupération       360 M   1024 K
  Partition 2    Système            200 M    361 M
  Partition 3    Réservé            128 M    561 M
  Partition 4    Principale         232 G    689 M
  Partition 5    Récupération      5200 M    233 G
DISKPART> select partition 1
La partition 1 est maintenant la partition sélectionnée.
DISKPART> detail partition
Partition 1
Type    : de94bba4-06d1-4d40-a16a-bfd50179d6ac
Masqué  : Oui
Requis  : Oui
Attrib  : 0X8000000000000001
Décalage en octets : 1048576
  N° volume   Ltr  Nom          Fs     Type        Taille   Statut     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 1         Windows RE   NTFS   Partition    360 M   Sain       Masqué
Confirmation via Reagentc :
''''''''''''''''''''''''''''
C:\Mes_DATAS\Doss_ISO_VHDs\X64\Oscdimg>reagentc /info
Informations sur la configuration de l'Environnement de récupération
Windows (WinRE) et la réinitialisation du système :
    État WinRE :        Enabled
    Emplacement WinRE : \\?\GLOBALROOT\device\harddisk0\partition1\Recovery\WindowsRE
    Identificateur des données de configuration du démarrage (BCD) : 10e6e67d-1c55-11e4-8882-586d8f137ecc
    Emplacement de l'image de récupération : \\?\GLOBALROOT\device\harddisk0\partition5\RecoveryImage
    Index de l'image de récupération :       1
    Emplacement de l'image personnalisée :
    Index de l'image personnalisée :         0
REAGENTC.EXE : opération réussie.
C:\Mes_DATAS\Doss_ISO_VHDs\X64\Oscdimg>
#######################################################################################################
--- Principe  du Compatibility Support Module (CSM) ---------------------------------------------------
#######################################################################################################
The Compatibility Support Module (CSM) is a component of the UEFI firmware that provides legacy BIOS 
compatibility by emulating a BIOS environment, allowing legacy operating systems and some option ROMs 
that do not support UEFI to still be used.
CSM also provides required legacy System Management Mode (SMM) functionality, called CompatibilitySmm, 
as an addition to features provided by the UEFI SMM. This is optional, and highly chipset and platform 
specific. An example of such a legacy SMM functionality is providing USB legacy support for keyboard 
and mouse, by emulating their classic PS/2 counterparts.

#######################################################################################################
--- Move systeme Partition (MBR disk Exemple) ---------------------------------------------------------
#######################################################################################################
La partition système correspond à la partition Systeme Reserved - Elle comporte l'environnement de démarrage
(Bootmgr, BCD, rep Boot,...)
Nous avons par exemple 2 disques avec les partitions suivantes sur un serveur :
DISKPART> select disk 0
Le disque 0 est maintenant le disque sélectionné.
DISKPART> list partition
  N° partition   Type              Taille   Décalage
  -------------  ----------------  -------  --------
  Partition 1    Principale         350 M   1024 K
  Partition 2    Principale         350 M   3501 M
DISKPART> select disk 1
Le disque 1 est maintenant le disque sélectionné.
DISKPART> list partition
  N° partition   Type              Taille   Décalage
  -------------  ----------------  -------  --------
  Partition 1    Principale        1000 M   1024 K
  Partition 2    Principale         500 M   1001 M
  Partition 3    Principale          10 G   1501 M
DISKPART>

La partition Système actuelle est la partition 2 du disk 0
Le but va être de déplacer son contenu vers la partition 1 du même disque pour faire en sorte que la partition 
système soit désormais placée en début de disque :

INFO 1 : détail sur la partition System Reserved actuelle
--------
DISKPART> detail partition
Partition 2
Type   : 07
Masqué : Non
Active : Oui
Décalage en octets : 3671064576
  N° volume   Ltr  Nom          Fs     Type        Taille   Statut     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 2     O   Réservé au   NTFS   Partition    350 M   Sain       Système
INFO 2 : détail sur la future partition System Reserved 
--------
DISKPART> detail partition
Partition 1
Type   : 07
Masqué : Non
Active : Non
Décalage en octets : 1048576
  N° volume   Ltr  Nom          Fs     Type        Taille   Statut     Info
  ----------  ---  -----------  -----  ----------  -------  ---------  --------
* Volume 1                      NTFS   Partition    350 M   Sain
INFO 3 :
--------
La partition 1 avait été créée et formattée en NTFS au préalable ainsi :
Diskpart
select disk 0
create partition primary size=350
select partition 1
format quick fs=NTFS Label="System Reserved and Recovery"
Remarque : la partition set en NTFS car la partition système ici est sur un disque MBR / système BIOS
(et non pas GTP / Système UEFI)
Détail de la procédure suivie pour déplacer la partition System reserved :
--------------------------------------------------------------------------
1 - export du >BCD actuel par précaution
bcdedit /export c:\ExportBCD
Pour info, la partition OS est sur le disk 1, partition 3 - La partition OS contient un volume dont la 
lettre de lecteur est C:\
2 - Décharger la ruche de la registry correspondant au BCD (si nécessaire fermer et ouvrir session si acess denied) :
C:\Users\Administrateur>reg unload hklm\bcd00000000
L'opération a réussi.
3 - assigner une lettre de lecteur à la partition système reserved actuelle
DISKPART> select disk 0
Le disque 0 est maintenant le disque sélectionné.
DISKPART> select partition 2
La partition 2 est maintenant la partition sélectionnée.
DISKPART> assign letter x:
DiskPart a correctement assigné la lettre de lecteur ou le point de montage.
DISKPART>
4 - Assigner une lettre de lecteur à la future partition System Reserved
DISKPART> select partition 1
La partition 1 est maintenant la partition sélectionnée.
DISKPART> assign letter Y:
DiskPart a correctement assigné la lettre de lecteur ou le point de montage.
DISKPART>
5 - copier tout le contenu de la partition System Reserved vers la nouvelle partition :
C:\Users\Administrateur>robocopy /mir /copyall /secfix /v /log:c:\robocopy-system-reserved.log /ETA /R:1 /W:1 X:\ Y:\
 Fichier journal : c:\robocopy-system-reserved.log
C:\Users\Administrateur>
6 - Copie des fichiers Recovery de la partition OS vers la future partition Systelm Reserved
C:\Users\Administrateur>robocopy /mir /copyall /secfix /v /log:c:\robocopy-Recovery.log /ETA /R:1 /W:1 C:\Recovery Y:\Recovery
7 - Vérifier la copie :
dir  Y:\  /ah
ou dir  Y:\  /a
8 - activer la nouvelle partition et désactiver l'ancienne 
C:\Users\Administrateur>diskpart
Microsoft DiskPart version 6.3.9600
Copyright (C) 1999-2013 Microsoft Corporation.
Sur l'ordinateur : ARS-MOVEMSR-01
DISKPART> list disk
  N° disque  Statut         Taille   Libre    Dyn  GPT
  ---------  -------------  -------  -------  ---  ---
  Disque 0    En ligne       5120 M octets  4418 M octets
  Disque 1    En ligne         12 G octets      0 octets
DISKPART> select disk 0
Le disque 0 est maintenant le disque sélectionné.
DISKPART> select partition 1
La partition 1 est maintenant la partition sélectionnée.
DISKPART> active
DiskPart a indiqué la partition actuelle comme étant active.
DISKPART> select partition 2
La partition 2 est maintenant la partition sélectionnée.
DISKPART> inactive
La partition actuelle est déjà marquée comme inactive.
DISKPART>
9 - adapter la BCD :
 bcdboot.exe c:\windows /s Y:
10 - adapter la Recovery Agent pour pointer vers la partition System Recovery désormais
C:\Users\Administrateur>reagentc /info
Informations sur la configuration de l'Environnement de récupération
Windows (WinRE) et la réinitialisation du système :
    État WinRE :        Enabled
    Emplacement WinRE : \\?\GLOBALROOT\device\harddisk1\partition3\Recovery\WindowsRE
    Identificateur des données de configuration du démarrage (BCD) : e0fd5422-5a
f7-11e4-958d-f42184b9eaf2
    Emplacement de l'image de récupération :
    Index de l'image de récupération :       0
    Emplacement de l'image personnalisée :
    Index de l'image personnalisée :         0
REAGENTC.EXE : opération réussie.
C:\Users\Administrateur>robocopy /mir /copyall /secfix /v /log:c:\robocopy-Recovery.log /ETA /R:1 /W:1 C:\Recovery Y:\Recovery\windowsRE
 Fichier journal : c:\robocopy-Recovery.log
C:\Users\Administrateur>robocopy /mir /copyall /secfix /v /log:c:\robocopy-Recovery.log /ETA /R:1 /W:1 C:\Recovery Y:\Recovery
 Fichier journal : c:\robocopy-Recovery.log
C:\Users\Administrateur>reagentc /disable
REAGENTC.EXE : opération réussie.
C:\Users\Administrateur>Reagentc.exe /setreimage /path Y:\Recovery\windowsRE /bootkey 8500
Répertoire défini : \\?\GLOBALROOT\device\harddisk0\partition1\Recovery\windowsRE
REAGENTC.EXE : opération réussie.
C:\Users\Administrateur>reagentc /enable
REAGENTC.EXE : opération réussie.
C:\Users\Administrateur>

11 - retirer les lettres de lecteurs affectés pour les manips aux 2 partitions concernées :
C:\Users\Administrateur>diskpart
Microsoft DiskPart version 6.3.9600
Copyright (C) 1999-2013 Microsoft Corporation.
Sur l'ordinateur : ARS-MOVEMSR-01
DISKPART> select disk 0
Le disque 0 est maintenant le disque sélectionné.
DISKPART> select partition 2
La partition 2 est maintenant la partition sélectionnée.
DISKPART> remove letter X:
DiskPart a correctement supprimé la lettre de lecteur ou le point de montage.
DISKPART> select partition 1
La partition 1 est maintenant la partition sélectionnée.
DISKPART> remove letter Y:
DiskPart a correctement supprimé la lettre de lecteur ou le point de montage.
DISKPART>

12 - Rebooter le serveur
Shutdown -r -t 00
13 - vérification BCDEDIT
C:\Users\Administrateur>bcdedit
Gestionnaire de démarrage Windows
---------------------------------
identificateur          {bootmgr}
device                  partition=\Device\HarddiskVolume1
description             Windows Boot Manager
locale                  en-us
inherit                 {globalsettings}
bootshutdowndisabled    Yes
default                 {current}
resumeobject            {5263e3b5-5b4b-11e4-80b4-00155d0b695d}
displayorder            {current}
toolsdisplayorder       {memdiag}
timeout                 30
Chargeur de démarrage Windows
-----------------------------
identificateur          {current}
device                  partition=C:
path                    \windows\system32\winload.exe
description             Windows Server 2012 R2
locale                  en-us
inherit                 {bootloadersettings}
allowedinmemorysettings 0x15000075
osdevice                partition=C:
systemroot              \windows
resumeobject            {5263e3b5-5b4b-11e4-80b4-00155d0b695d}
nx                      OptOut
detecthal               Yes
C:\Users\Administrateur>

14 - r&éactivation Recovery :
C:\Users\Administrateur>reagentc /info
Informations sur la configuration de l'Environnement de récupération
Windows (WinRE) et la réinitialisation du système :
    État WinRE :        Disabled
    Emplacement WinRE :
    Identificateur des données de configuration du démarrage (BCD) : e0fd5424-5a
f7-11e4-958d-f42184b9eaf2
    Emplacement de l'image de récupération :
    Index de l'image de récupération :       0
    Emplacement de l'image personnalisée :
    Index de l'image personnalisée :         0
REAGENTC.EXE : opération réussie.

C:\Users\Administrateur>reagentc /enable
REAGENTC.EXE : opération réussie.

C:\Users\Administrateur>reagentc /info
Informations sur la configuration de l'Environnement de récupération
Windows (WinRE) et la réinitialisation du système :
    État WinRE :        Enabled
    Emplacement WinRE : \\?\GLOBALROOT\device\harddisk0\partition1\Recovery\Wind
owsRE
    Identificateur des données de configuration du démarrage (BCD) : 5d38dc55-5b
51-11e4-80b5-00155d0b695d
    Emplacement de l'image de récupération :
    Index de l'image de récupération :       0
    Emplacement de l'image personnalisée :
    Index de l'image personnalisée :         0
REAGENTC.EXE : opération réussie.

C:\Users\Administrateur>

15 - suppression de l'ancienne partition System Reserved via diskpart et reboot final
DISKPART> select disk 0
Le disque 0 est maintenant le disque sélectionné.
DISKPART> list partition
  N° partition   Type              Taille   Décalage
  -------------  ----------------  -------  --------
  Partition 1    Principale         350 M   1024 K
  Partition 2    Principale         350 M   3501 M
DISKPART> select partition 2
La partition 2 est maintenant la partition sélectionnée.
DISKPART> delete partition
DiskPart a correctement supprimé la partition sélectionnée.
DISKPART> list partition
  N° partition   Type              Taille   Décalage
  -------------  ----------------  -------  --------
  Partition 1    Principale         350 M   1024 K
DISKPART> 
C:\Users\Administrateur>Shutdown -r -t 00


#######################################################################################################
--- Converting Windows BIOS installation to UEFI ------------------------------------------------------
#######################################################################################################
There are several reasons to use UEFI instead of BIOS. I won't go into details regarding that. 
But there are some cases when you already have a fully functional Windows installation running on BIOS 
and you don't want to start all over again. Sadly, there are no tools that performs this job. And I found 
there is not too much documentation regarding how this can be performed either, or even how this should work. 
Since after some digging and trial-and-error I was able to perform the operation, I will post the 
instructions for anyone who needs it.
Goal:
-----
Convert a Windows 7/8 BIOS (MBR) installation to UEFI (GPT) without moving, copying or loosing data.
Prerequisites:
--------------
1.A computer able to boot UEFI. You can check that on your computer manufacturer. 
  Also in the BIOS setup should display UEFI boot options. 
2.Windows 7/8 x64 (I'm not sure if x86 supports it or how). 
3.A computer able to boot from USB or memory card (only for this process). 
4.A pen drive or memory card with at least 4GB. Or a Windows installation disc. 
5.BitLocker TURNED OFF. If you have BitLocker enabled on your hard drive, it will have to be TOTALLY 
  turned off for this procedure. After the procedure is performed, BitLocker can be turned on again. 
6.A "standard" Windows installation. This means, the disk where Windows is installed has to contain the 
  System Partition (something above 200MB) and then the OS Partition. This is because Windows will require 
  some space at the beginning of the disk to create the new boot partitions, and we will use the previous 
  System Partition. To verify this you can follow Instructions steps 8 through 11. If there isn't enough 
  space at the beginning (the primary small partition is under 200MB), partitions may be resized using some 
  tool like Easeus Partition Master or such. Don't continue the operation until you have done so because you 
  may not be able to finish it.  
Warnings:
---------
1.As usually, I won't take any responsibilities if data is being lost, your computer doesn't boot up anymore, 
  or some gremlins attack your family. You are doing this at your own responsibility.
2.After this procedure, old versions of Windows probable won't be able to boot from this disk drive
since it has to be converted to GPT. 
Recommendations:
----------------
1.Is VERY recommended for you to perform a backup of your data. If you have a second disk drive big enough, 
  you can simply create a system image and able to recover the full installation as it was before you started 
  this procedure if anything goes wrong. 
2.Download this guide to another computer or print it out, since you will have to make some operations 
  without Windows working. 
3.These procedures are likely to render your on-board Recovery partition unusable. Thus, a backup of your 
  Recovery partition onto a USB device is highly recommended if your PC came with Win 8 preinstalled or you don't 
  have your Windows installation media. Once created, this bootable Recovery USB can optionally be substituted for
  the System Repair disc in the steps below.
  For a creating the Recovery USB, see the following: 
  http://www.techrepublic.com/blog/window-on-windows/create-a-recovery-drive-in-windows-8/7261   
Notes:
------
Steps were performed on Windows 8. Some steps in Windows 7 may have different menus, 
but the options and results are the same.
Instructions:
-------------
1.Create a system repair disc (http://windows.microsoft.com/en-US/windows7/Create-a-system-repair-disc).
  You can skip this step if you have a Windows installation media. Is a good measure to reboot and verify 
  you can start your system from this disc. 
2.Identify which disk you want to convert (usually is #0). This can be done by looking at the number in 
  the Windows Disk Management. 
3.Download gptgen from here http://sourceforge.net/projects/gptgen  . This tool will allow you to convert your 
  MBR disc to GPT with the data included. 
4.ATTENTION: After this step, you won't be able to boot into Windows the whole process is completed. 
  There is no turning back! 
  Unzip gptgen and then run CMD with elevated privileges. (replace the 0 with the identified disk number). 
  This *will* result in a BSOD shortly after and it's to be expected:
  gptgen.exe -w \\.\physicaldrive0
 
5.Boot using your Windows installation or previously generated system repair disc. 
6.Choose language and preferences, and then select Repair Your Computer 
  -> Troubleshoot -> Advanced options -> Command Prompt 
7.We will need the disk partitioning tool. With this, we will recreate the boot partitions. Type:
  diskpart 
8.Identify the boot disk where Windows is located, typing:
  list disk 
  Something like this should appear:
      Disk ###  Status         Size     Free     Dyn  Gpt
       --------  -------------  -------  -------  ---  ---
     * Disk 0    Online          128 GB      0 B        * 
9.Once identified, select the disk (replace with the correct number):
  select disk 0 
10.Verify the partitions:
   list partition 
11.Something similar at the info below should appear.
       Partition ###  Type              Size     Offset
        -------------  ----------------  -------  -------
        Partition 1    Primary            350 MB  1024 KB
        Partition 2    Primary            126 GB   350 MB 
12.Delete the previous system partition:
   select partition 1
   delete partition
13.Create the new boot partition, Microsoft reserved partition:
   create partition EFI size=100 offset=1
   format quick fs=fat32 label="System" 
   assign letter=S
   create partition msr size=128 offset=103424 
14.If you list the partitions again, you should have ended up with something like this:
       Partition ###  Type              Size     Offset
        -------------  ----------------  -------  -------
        Partition 1    System             100 MB  1024 KB
        Partition 2    Reserved           128 MB   101 MB
        Partition 3    Primary            126 GB   229 MB 
15.Ensure that your Windows installation is mounted, replacing 3 with the volume number 
   of the Windows installation (usually 1):
   list volume
   select volume 3
   assign letter=C 
16.Exit diskpart:
   exit 
17.Generate boot partition data, replacing C: with the letter of the Windows 
   installation (usually C:):
   bcdboot c:\windows /s s: /f UEFI 
18.Cross your fingers and then restart your computer! 
Final tasks:
------------
1.BitLocker can be enabled again. 
2.If Hyper-V was installed before this procedure, it may not work. To fix it, just remove the
  feature, restart your PC and then enable it again. No VM is lost. 
3.In Windows 8 and if the computer supports it, Windows 8 Secure Boot can be enabled inside the computer 
  BIOS. This will improve the computer security by some degree and maybe reduce boot time. Refer to 
  information from your system manufacturer and/or  
  http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot  





Retour...

Booter Windows sur un disque VHD (en anglais)



######################################################################################################
###### Configuring Native VHD Boot on a Single Computer ##############################################
######################################################################################################

The goal of this scenario is to gain familiarity with the steps that are required to enable native 
VHD boot by using an existing installation of Windows 7. Alternatively, you can use Windows Server 
2008 R2 in this scenario as the steps are the same for both operating systems. 
NB : Only Windows 7 Enterprise or Windows 7 Ultimate can be used with native VHD boot.
In this scenario, you will create a VHD and apply an image to the new VHD by using tools from 
the Windows Automated Installation Kit (Windows AIK). Then, you will alter the BCD store so that you 
can boot to the operating system within the VHD. To summarize, you will take the following steps :

- Install the Windows AIK 
- Create a VHD through the user interface 
- Mount the VHD and create a partition on it 
- Apply Windows 7 to the VHD 
- Configure the BCD store

Prerequisites :
-------------------

Before you proceed, ensure you have the following available:
- A computer running Windows 7 Enterprise, Windows 7 Ultimate, or Windows Server 2008 R2
- The installation media for Windows 7 Enterprise, Windows 7 Ultimate, or Windows Server 2008 R2
NB : If you have Windows 7 or Windows Server 2008 R2 in the .iso format, extract the .iso files 
as flat files or burn them to a DVD 
- Media that contains the Windows AIK installation files (http://go.microsoft.com/fwlink/?LinkID=154426) 

Step 1: 
--------

Install the Windows AIK

Before you create a VHD file, you need to install the Windows AIK on the local computer. 
This kit is full of utilities for deploying and maintaining images (.wim files and .vhd files). 
To install the kit, use the following procedure.
To install the Windows AIK

1.Browse to the location where you stored the Windows AIK media and double-click Startcd.exe.
2.In the User Account Control dialog box, click Yes.
3.In the left pane of the Welcome to the Windows Automated Installation Kit page, click Windows AIK setup.
4.On the Windows Automated Installation Kit Setup Wizard page, click Next.
5.On the License Terms page, select I agree, and then click Next.
6.Select an appropriate installation folder or leave the default setting, and then click Next.
7.On the Confirm Installation page, click Next and wait for the installation to finish.
8.After the installation has finished, click Close to exit the Windows AIK setup.
          When the installation is successful, you have installed all the tools that you will need. 
 The primary tool you will use in this scenario is ImageX, which you will use to apply the image to
 the VHD. But before you can apply the image, you need to create the VHD as explained in the next step.

Step 2 : 
---------

Create the VHD 

To store the VHDs that you will create, this example scenario uses a local folder, 
C:\VHD Files. However, you can use any name and location that you desire. *
Instead of storing VHDs in a subfolder, you could store them in the root of the drive. 
Use the following procedure to create a VHD by using the user interface.
To create a VHD by using Disk Management
1.On the start menu, right-click Computer, and then click Manage.
2.In the User Account Control dialog box, click Yes. 
3.In the left pane of the Computer Management console, click Disk Management. 
4.In the right pane, click More Actions, and then click Create VHD.
5.On the Create and attach Virtual Hard Disk page, specify the following settings, and then click OK:
? Location: C:\VHD Files\WIN7.vhd 
? Virtual hard disk size: 50 GB 
? Virtual hard disk format: Dynamically expanding 
 You should create a dynamically expanding VHD only when you want to save on the amount 
 of initial disk space that you use. With this option, only a small VHD is created initially, 
 and it will grow dynamically as you add data to the VHD. However, using this type of file 
 has an impact on performance because not all blocks are consistently written next to each
 other on the physical disk. For servers or workstations where performance is of concern, 
 you should consider creating a fixed-size VHD.
             NB : If this is the first time that you have created a VHD, an indicator appears in the notification 
 area to inform you that a driver is being installed. 
  6.The next thing you need to do is initialize the disk. In Disk Management, right-click 
 the 50 GB disk that you just created (notice that the VHD is distinguished with a light blue icon), 
 and then select Initialize Disk.
7.On the Initialize Disk page, ensure that the VHD you just created is selected and that MBR is 
 the selected partition style. Click OK. 
8.After the disk is initialized, you can create a partition on it. Right-click the unallocated 
 space of the disk, and then click New Simple Volume.
9.In the Welcome to the New Simple Volume Wizard, click Next.
10.On the Specify Volume Size page, leave the default values (you will use the entire size of the disk as the system volume), and then click Next. 
11.In the Assign Drive Letter or Path list, choose drive letter V:, and then click Next. 
12.Under Format this volume with the following settings, specify the following options, and then click Next:
? File system: NTFS
? Allocation unit size: Default 
? Volume label: system
13.To create the partition, on the Completing the New Simple Volume Wizard page, click Finish. 
 Wait a few second for the partition to be created. Do not close the Computer Management console 
 yet because you will need it later in this scenario.

Step 3: 
---------

Apply the Windows image to the VHD
One of the limitations of native VHD boot is that it is only available with Windows 7 Enterprise, 
Windows 7 Ultimate, or Windows Server 2008 R2 (all editions). Windows image (.wim) files often 
contain more than one edition of Windows, so you first need to determine the edition (and its “index 
number”) that you want to use. This is especially true for the Install.wim file that is available on 
the installation media. In Step 1, you installed the Windows AIK, which contains the tools to determine 
the index number. In the following procedure, you will search for the index number (in this example 
Windows 7 Enterprise), and then you will apply Windows 7 Enterprise to the VHD. The tool you will 
ause is new to Windows 7; it is called Deployment Image Servicing and Management (DISM). 
To perform these steps, use the following procedure.
To apply a Windows image to the VHD
1.Click Start, point to All Programs, and then click Microsoft Windows AIK. 
2.Right-click Deployment Tools Command Prompt, and then click Run as administrator.
3.In the User Account Control dialog box, click Yes.
4.Type the following DISM command to view information about the editions of Windows within the .wim file.
dism /Get-Wiminfo /Wimfile:”C:\Sources\Windows 7 Enterprise\Sources\install.wim”
 You will see that there is only one edition of Windows 7 Enterprise available in the .wim file. 
 Remember the index number because you will use it in the next step to apply the data to the VHD.
 NB : If you want more information about a specific edition of Windows 7 in the .wim, type /Index:<Number> 
        at the end of the previous command.
  5.Now that you have the index number, you can apply the data from the .wim file to the VHD. To do this, type the following ImageX command:
imagex /apply ”C:\Sources\Windows 7 Enterprise\Sources\install.wim” 1 v:
 Wait for the command to finish. The whole process can take 10 minutes or longer depending on the performance of your computer.
6.Type exit in the Command Prompt window to close it.

Step 4:
---------

Change the boot configuration data
You have almost completed the steps that are required for booting to a VHD. 
The last task is to change the boot configuration data (BCD) store, which is essentially the successor 
to the Boot.ini file in previous versions of Windows. The default tool for editing the BCD store is 
the BCDEdit command-line tool.
Next, you will use BCDEdit to add a boot entry to the store. This will enable you to select the VHD 
when you start the computer. To do this, use the steps in the following procedure.
To change the BCD
1.Open an elevated Command Prompt window (click Start, right-click Command Prompt, and click Run as administrator). 
2.In the User Account Control dialog box, click Yes.
3.To take a first look at the BCD store, you will use BCDEdit to view (enumerate) the current Windows 
 Boot Loader entries. To do this, type bcdedit /enum.
4.You could create a new entry manually, but it is easier to copy the settings from the current 
 boot entry and use that as a starting point. To copy the current entry, type the following command:
bcdedit /copy {current} / d “Windows 7 VHD Boot”
 The output will generate a GUID, which is associated with the new boot entry. Take note of this 
 GUID because you will use it to change settings in the next step.
5.You need to change two crucial settings in the boot loader entry. These settings tell the Windows 
 Boot Manager to look for the VHD during initialization. Type the following commands with the appropriate 
 GUID to alter the device and osdevice settings of the new boot entry. 
bcdedit /set {d89f3fa4-6416-11de-b070-b08b383b8f33} device vhd=”[locate]\VHD Files\WIN7.vhd”
bcdedit /set {d89f3fa4-6416-11de-b070-b08b383b8f33} osdevice vhd=”[locate]\VHD Files\WIN7.vhd”
 The setting [locate] instructs Windows Boot Manager to locate the VHD without requiring you 
 to specify a drive letter.
6.Because you will be using an installation of Windows 7 in the VHD, you also need Windows Boot Manager 
 to detect the hardware abstraction layer (HAL) during setup. The HAL is basically an interface between 
 the software and hardware of the computer. To enable a setting to make this possible, type the following command:
bcdedit /set {d89f3fa4-6416-11de-b070-b08b383b8f33} detecthal Yes
 NB : If you want to set the VHD boot loader entry as the default boot configuration, type the following 
 command: Bcdedit /default {d89f3fa4-6416-11de-b070-b08b383b8f33}
  7.If you run the bcdedit /enum command again, you will see the new entry in the output,
8.You have now created a boot entry for the VHD that you created earlier. 
 Type exit in the Command Prompt window to close it.

Step 5 : 
----------

Detach the VHD
The final step is to detach the VHD. This prevents data corruption, which can occur if you restart the computer 
while the VHD is attached. If the VHD remains attached, files could remain open or locked, and the data on the 
VHD would eventually be damaged. Just like attaching a VHD, you can detach the VHD by using the Disk Management 
user interface. Assuming that the Computer Management console is still open, use the following procedure to detach the VHD.
To detach the VHD 
1.In Disk Management, right-click the disk that represents the attached VHD, and then click Detach VHD. 
 (Remember that the disk is displayed with a light blue icon.)
2.On the Detach Virtual Hard Disk page, ensure that the Delete the virtual hard disk file after 
 removing the disk check box is not selected, and then click OK.
3.Close the Computer Management console. 
You have now completed all the steps to create a VHD, apply an operating system to it, and configure the BCD store so 
that users can select the VHD when they start the computer. All that remains is to restart the computer and start the installation.









Retour...

Contact :

Patrice Guilloux
Sociéte : AR Systèmes 
FRANCE

pguilloux@outlook.com
Certifié Microsoft :



Certifié HP (APC, AIS, ASE, Master ASE) :
 
   
© Copyright SiteName. Tous droits réservés.