This article is the second part of guide Perform a manual Windows Server setup using DISM on UEFI/GPT partitions. Please follow steps on Part 1 before going trough this article

First part was about the drive file system and formating. In this part we will setup Windows Server (here 2012 R2 Standard with a gui). If you just followed the first part, please do not forget to quit Diskpart before beginning.

By following this guide, you should follow all steps. This article is provided as is, without warranty of any kind

Since most of the commands of this guide are "one-lined", i'll describe each used flags.

First, we will copy the setup image to the recovery image partition.

copy D:\sources\install.wim R:\
Command/Switch Description
copy   this is the copy command (same as xcopy). 
copy source destination
D:\sources\install.wim source 
The install.wim file on your source media. In my case located on D:\
R:\ destination
The Recovery Image Partition we created on first part of this guide and assigned with the R: letter

When going trought the setup wizard, you get the choice to select the operating system you want to install:

All these versions are included in your install.wim and flagged by a index ID. Just to make sure to select the right version, we will now list those images indexes.

dism /get-imageinfo /imagefile:R:\install.wim

As you may see on the above screenshot, we find 4 indexes:

Index ID Windows Version
1 Windows Server 2012 R2 Server Standard Core
2 Windows Server 2012 R2 Server Standard
3 Windows Server 2012 R2 Server Datacenter Core
4 Windows Server 2012 R2 Server Datacenter

Make sure to select the right version for next commands where we will refer to index. For this guide we will setup the Windows Server 2012 R2 Standard, so we will use index 2.

We now will apply (finaly wink) our Windows image on the Windows Partition we created on the First part of this guide.

dism /apply-image /imagefile:R:\install.wim /index:2 /applydir:W:\
Command/Switch Description
dism This is the Deployment Image Servicing and Management tool.
/apply-image the switch to tell dism we want to apply an image
/imagefile:R:\install.wim this switch allow you to specify the image file you want to appply
/index:2 this switch allow you to select the index in your image file for the Windows version
/applydir:W:\ The directory you want to apply the image to. Here W: is the drive letter we used for the Windows Partition on First part

Alright, we applied the image but we are not done yet. We now need to tune some settings to be able to boot properly uner our brand new Windows installation.

One point that may cause issues when setting up your password on the first logon is the regional settings; so let's check how regional settings were deployed on our new Windows installation.

dism /image:W:\ /get-intl
Command/Switch Description
/image:W:\ the image drive root location
/get-intl Switch that will read the International Settings of our Windows installation

We can see here that all settings are set to en-US by default. This include the System Locale, the User Locale, the Keyboard layout and even the default Timezone. On my case I needed to set all regional settings to fr-BE (Belgian French) but to keep the system language in English (you will not be able to change language without language packs anyway).

Let's change those settings to fr-BE and set the right Timezone :

dism /image:W:\ /set-Syslocale:fr-BE
dism /image:W:\ /set-Userlocale:fr-BE
dism /image:W:\ /set-Inputlocale:fr-BE
dism /image:W:\ /set-Timezone:"W. Europe Standard Time"
Command/Switch Description
/set-Syslocale:fr-BE Define the System Locale setting to fr-BE
/set-Userlocale:fr-BE Define the User Locale setting to fr-BE
/set-Inputlocale:fr-BE Define the keyboard layout to fr-BE. May be defined by specific id's too
/set-Timezone:"W. Europe Standard Time" Set the Timezone. You may find Timezone keys under registry at:
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\TimeZones\

If we now try the dism /image:W:\ /get-intl command again, we will now see our modified settings:

Now we made this fine tuning, we need to take care of our recovery environment to make sure widows can recover in case of problems.
We'll copy the recovery image to the recovery partition :

md T:\Recovery\WindowsRE
attrib W:\Windows\System32\Recovery\Winre.wim -h -s -r
copy W:\Windows\System32\Recovery\Winre.wim T:\Recovery\WindowsRE\winre.wim
Command/Switch Description
md T:\Recovery\WindowsRE We create a directory in the Windows RE partition identified by T: on  First part
attrib W:\Windows\System32\Recovery\Winre.wom -h -s -r We need to change attributes of the recovery file present in our Windows installation to be able to copy it. For this we use the attrib command.
-h to clear the "hidden file" attribute
-s to clear the "System File" attribute
-r to clear the "Read Only" attribute
copy W:\Windows\System32\Recovery\Winre.wim T:\Recovery\WindowsRE\winre.wim copy the recovery image of our Windows installation to the Windows RE partition

We will now edit the boot file to tell him our Windows location. We will use the /l flag to specify the locale to use:

bcdboot w:\windows /l fr-BE

We now need some additional settings on our partitions. In the System partition, set the location of the Windows partition

md R:\RecoveryImage
W:\Windows\System32\reagentc /setosimage /path R:\RecoveryImage /target W:\Windows /index 1

In the System partition, set the location of the WinRE tools

​W:\Windows\System32\reagentc /setreimage /path T:\Recovery\WindowsRE /target W:\Windows

We are now done with commands ! You may now type a very last commande to initiate computer reboot laugh

w:\Windows\system32\shutdown.exe /t 0 /r

We will now make sure everything is OK.

After the reboot you should see windows finalizing some settings like getting devices ready  and after one other reboot, you should see the following screen (settings will change depending of your locale settings applied during setup):

Simply hit next button, settings should be OK wink, now accept the EULA

Set your administrator password

Now you're logged on the Windows, wait for Server Manager to finish collecting data and find the File and Storage services link

There, on the Disks section, you'll see on the right pane your Disk and format still in GPT file system.

Now, enjoy setting up roles and features on this brand new installation !