Thursday, February 27, 2014

Windows Server 2012 R2 ESSENTIALS: Virtualization How-To, Physical Hyper-V Host and Virtual Server (VM)

This is intended to be a guide how to install Microsoft Windows Server 2012 R2 ESSENTIALS as a virtual server, i.e. inside a virtual machine (VM). This VM will run on a physical Hyper-V host which will be again Windows Server 2012 R2 ESSENTIALS itself. This type of installation is allowed by Microsoft but they have not included a tool to simplify the process. In order to achieve our aim, we need to modify the original ISO by removing the Essentials Role and Essentials Setup using Microsoft's own tools.

DISCLAIMER: To my best knowledge everything described here complies with the MS license terms. It worked for me but does not mean that it will work for you as is. So make sure that you have understood everything and check if each step applies to your system. There is no liability for damages.

Physical Hyper-V Host vs Virtual Server (Guest VM)

Windows Server 2012 R2 Essentials is a very interesting operating system for small businesses. What many people don't know: Microsoft now allows you to do one physical installation - let's call it Hyper-V Host Installation - plus one virtual installation - let's call it the actual Server Essentials inside a Virtual Machine (VM). This is explained here:

Virtualization Obstacles

Unfortunately, to make your life as complicated as possible, Microsoft has not made the virtualization straightforward. The problem is that the Essentials Role needs to be manually removed before doing the installation on the physical host: It is not only useless for the Hyper-V physical host but it will also interfere with the Server Essentials we want to install later as a virtual server in a VM. MS has not included an option to remove the Essentials role. They have decided to leave this option for OEMs only, so these have to decide for you if they want to include the virtualization for your server or not - stupid! At the time of this writing MS offers some explanations how the install image needs to be modified to remove the essentials role but these are complex and even include mistakes:

Why not just use the free Microsoft Hyper-V Server for the Host?

I also thought about using the free Hyper-V Server instead of Server 2012 R2 Essentials on the physical host. Free Hyper-V Server even gives you unlimited VMs, but it is "command line only" (no GUI!) and is hard to use for entry level admins. Also it probably does not include Windows Server Backup which is very handy to backup the Server Essentials VM from the host. Graphical tools for RAID monitoring etc. will not be usable without full GUI.

The Idea

So I decided to write a step-by-step guide. But first I thank for the help I received from Moodjbow's blog:

So my basic idea was the following:

1. It should be possible to cleanly modify the original ISO according to the MS guides to get a Hyper-V “Physical-Host-Only” ISO to install, without Active Directory, etc. IMHO there is no need to auto-include the guest VM (as MS does in its guides) which just makes things more complex and inflexible!

2. The Server Essentials can then be just installed inside that physical host from the original unmodified ISO as a Guest VM. This way we can also configure the VM as we like before installing. Clean and easy!

Let's get to work!

Step-by-Step: Creating the ISO for the Hyper-V-Host Installation

Preparation: Install the Windows 8.1 ADK (Assessment and Deployment Kit)

First you need to download and install the free Win 8.1 ADK on your PC where you will prepare the modified ISO. You should be able to do this on Windows 8.0, Windows 8.1 and probably on Server 2012 R2 but I have not tested them all. I have actually installed it on Windows 7 as it is also compatible with the Windows 8.1 ADK.

After having installed the ADK to its default directory open a Windows COMMAND PROMPT AS ADMINISTRATOR.

IMPORTANT !!! From now on every executable must be started by first changing to the correct ADK directory, otherwise Windows will execute the .exe from your OS path!!!

### CREATE TWO WORKING DIRS: Create the following directories:

md c:\essentials-host-image
md c:\essentials-host-mount

### COPY ISO CONTENTS: Insert your Windows Server 2012 R2 ESSENTIALS CD and copy all files and folders (including subfolders) to c:\essentials-host-image

## CHANGE TO ADK DIR (one line):

cd "C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\DISM"

### MOUNT IMAGE: Mounts the image into a temp directory - takes a while (one line)

dism /Mount-Image /ImageFile:"C:\essentials-host-image\sources\install.wim" /Index:1 /MountDir:"C:\essentials-host-mount"

### FOR MY INFO ONLY (you don't have to execute the two lines below):
[ dism /Image:C:\essentials-host-mount /Get-Features > myfeatures.txt ]   
    --> print all features to file
[ dism /Image:C:\essentials-host-mount /Get-Packages > mypackages.txt]   
    --> print all packages to file


dism /Image:C:\essentials-host-mount /Disable-Feature:"WSS-Product-Package"
dism /Image:C:\essentials-host-mount /Disable-Feature:"Microsoft-Windows-ServerEssentials-ServerSetup"


dism /unmount-Wim /MountDir:C:\essentials-host-mount /commit
### INFO ONLY: /discard instead of /commit discards

### CREATE ISO (change dir first, then create the ISO as C:\OEMEssentialsHost.iso (two lines below) :

cd "C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Deployment Tools\amd64\Oscdimg"

oscdimg -m -o -u2 -udfver102 -bootdata:2#p0,e,bc:\essentials-host-image\boot\,e,bc:\essentials-host-image\efi\microsoft\boot\efisys.bin C:\essentials-host-image C:\OEMEssentialsHost.iso

Burn your C:\OEMEssentialsHost.iso to a CD!

Congratulations! You should now have a Host-Only installer CD without the Essentials stuff. Don't forget to thank Microsoft for making your life so complicated.

Installation of the physical host OS from the modified ISO

Install the physical host OS form the ISO. After installation, if needed, you can remove some more features and add-ons you don't need through the normal server manager GUI - the aim is to have a cleaned up host OS.

Don't forget to install your Hyper-V role!

Then create your Hyper-V VM and install your virtual Windows Server 2012 R2 Essentials inside, this time from the original MS ISO, not from your modified host image!

UPDATE: Joining the Hyper-V host to the domain

Yes, after reading many comments and discussions on the topic I have decided to add the physical host to the domain, i.e. to the Server 2012 R2 Essentials VM running on itself. IMHO this has many benefits regarding administration etc. and seems to work fine (caution, see below). Ok, you may get some warnings in the logs because your host will not be able to immediately reach the virtual domain controller during startup, as it has not started yet (a kind of chicken-egg-problem) but this is nothing to really worry about.

The only problem is again... Microsoft. Although the server is properly licensened, i.e. they allow you this type of installation as described here:

there is some stupid Server Infrastructure Licensing Service (silsvc.exe) that is watching your server and thinks that you are running two 2012 R2 Essential Servers in your domain as soon as you have joined the host to your domain, although we have removed all roles on our physical server. This stupid silsvc.exe will then shut down your server and stop your business after one week, you will then need to manually restart the server and this shutdown will happen again after one week. I.e. Microsoft dares to shut down your properly licensed server (according to their own licensing information) without even giving you a clear warning that this will happen, which is IMHO inacceptable behavior! In their licensing blog they don't even tell you that the server host is not expected to be joined to the domain but has to stay in a workgroup. Leaving it in a workgroup has some other serious drawbacks I am not going to discuss here. It is also ridiculous that Microsoft posts licensing information on a some blog - but as you know nowadays they don't seem to even care about writing some serious documentation for the products they sell. This is no open source, we pay for this stupid software and expect it to at least not intentionally shut down our business because it has incorrectly (!) implemented licensing watchguards. Looks like they don't understand their own licensing... For a workaround to this stupid problem read here:

and here

Hope this helps!