Install Windows Server 2012 R2 in UEFI Mode on USB

0. Here I leave notes on how to install windows server 2012 R2 on a USB attached HDD. I did all of below from Windows 8.1 Enterprise Evaluate edition on Virtualbox. 1. Run CMD as an administrator. 2. Partitioning

# Start diskpart.exe
# Show available disks
list disk
# Choose the disk
select disk 1
# Change label to gpt
convert gpt
# Create EFI partition of 100MB
create partition efi size=100
# Format as fat32
format quick fs=fat32 label="BOOT"
# Assign a windows drive letter of your preference.
assign letter=B
# Create OS partition of 128GB
create partition primary size=128000 format quick fs=ntfs label="OS"
assign letter=O
list volume

3. Installing the OS on USB

# Find available index number of edition.
dism /Get-WimInfo /WimFile:c:\install.wim
# Extract install.wim from the OS media, and place it on C drive root, and then run command below.
dism /apply-image /imagefile:c:\install.wim /index:2 /applydir:o:\

4. Install bootmgr on efi partion.

o:\windows\system32\bcdboot o:\windows /f ALL /s b:

5. Boot the PC from the USB drive, and finish the setup.