If you have an MSDN subscription, then hopefully you understand the “data center” you have at your fingertips. Sure, you get your $150/month credit towards Azure, and you can host things there. However, with computer hardware being crazy-cheap, you can also host a modest “server” (really, just a PC) which hosts several virtual machines. If you have MSDN, you can use Hyper-V as your VM host, and you’ll also have plenty of licenses to bring up servers, set up a domain, etc.
In the past, I would set up server, using a “Standard” and “Data Center” edition of Windows Server and enable the Hyper-V role. This is good because you get the full GUI, but it also burns a license too. You only have so many, so it’d be nice not to have to use a license for a server – which only hosts other servers!
What is Microsoft Hyper-V Server?
Instead of installing the full-blown version of Windows Server, you’ll see in MSDN:
there is a “Microsoft Hyper-V Server 2012 R2” (as of this writing). This doesn’t require a license, and is basically a core installation of server and Hyper-V and that’s it. It’s a version of Windows Server that ONLY has Hyper-V on it, and that’s all you can use it for. That sounds good, in theory!
I’ve shied away from it in the past, because “Server Core” is a bear to manage. You see, it’s Windows Server, but you only have a command-prompt. There are NO GUI tools. That means no: server manager, hyper-v manager, Windows Explorer, etc. To manage an instance of Server Core, you pretty much use PowerShell, or use the Remote Server Administration Tools remotely from another server or Windows-based workstation.
Note that this operating system is only released in 64-bit, so you need a 64-bit processor (which is pretty common nowadays), and it needs to support:
- Hardware-assisted virtualization
- Hardware-enforced Data Execution Prevention (DEP)
You also probably want to have a Solid State Drive (SSD) to host your virtual machines (so they won’t be slow), and the more RAM you have, the more machines you can host. So, if you have a machine laying around like this – then you’re ready. You can go to www.crucial.com and look up your computer model or motherboard model, and see how much RAM is supports. Nowadays, most motherboards support 16 or 32GB of RAM. So, if you leave 2GB for the host machine, and give each server 2GB of RAM, you could host 7 virtual machines on that one physical machine. That’s quite a little professional development sandbox from which you can learn!
How to setup Microsoft Hyper-V Server?
This is the easy part. You download the installer from MSDN, burn a DVD, put it in the drive and boot-up. Follow the prompts and you’re done. It’s very fast and simple – and again, doesn’t require a license. Now, when you log in, you’ll find yourself on a screen like this:
This is it; this is your server console! The blue screen is “sconfig.cmd” and is a shell-like menu system that lets you do a few systems management-type things. The black screen it just a regular command-prompt.
Now, the basic things like: computer name, joining a domain, setting the timezone, etc are all available here – but what about Hyper-V? Well, despite Hyper-V literally being the name of this edition, there is no command-line interface nor GUI for administering Hyper-V. You either have to use PowerShell commands or administer it remotely.
If you want to watch a video, I watched this one before I jumped in – and it explained a fair amount:
Administering the new Hyper-V server core:
Needless to say, this is more than a little awkward. The Windows command-line is notoriously useless, and with PowerShell, there is quite a learning curve. So, to use this operating system is difficult, right-off-the-bat! To configure disks, you must use “diskpart” (here is a decent tutorial), and as far as Hyper-V, as discussed, you have two options, use PowerShell, or RSAT.
Using PowerShell: this is already going to be more miserable than you think it is. First, PowerShell ISE is not installed – so you don’t have an editor to work in, no intellisense or help. Next, when I searched for PowerShell commands there doesn’t seem to be one place to get them – and I can’t tell if they are already loaded. So, I do a:
PS> Get-Module –ListAvailable
and I see “Hyper-V” in the list, so I do:
PS> Import-Module Hyper-V
I don’t get any errors, so that’s good. Now, to see what functions are available, I can now:
PS> Get-Command –Module Hyper-V
and that gives me a long list of commands. I didn’t spend a long time on this – but here are some of the more interesting looking commands which might be analogs to what you already know in the Hyper-V Manager application (this is not the complete list):
- Remove-* (same as all of the “Add-*” commands)
That’s all great, but then I find a lot of pages pointing to this “library”, which seems to be just a bunch of scripts: http://pshyperv.codeplex.com/ which leads to the next inconvenience, there is no web browser on this server. So, you’d need to download this on your workstation and then copy it to a share on the Hyper-V server. Bottom line, it looks like you could administer your Hyper-V server this way, but without some serious automation scripts (which would be nice!) – it’s probably going to be pretty painful.
Using RSAT: the other option for administering the server is to install the Remote Server Administration Tools (RSAT) on your workstation, or add this as a “Feature” on an existing Windows Server installation. On Windows 10 Enterprise with Hyper-V installed, I get this error when I tried to connect to that Hyper-V server:
I didn’t find a solution to this, but several people alluded to the idea that the Windows 10 tooling hasn’t been updated yet? I’ve only tried this from a Windows 10 Enterprise setup – connecting to that new Hyper-V server.
To even get this far too, you workstation MUST be in the same Windows domain as the server.
Next, I logged onto another Window Server 2012 R2 which has Hyper-V installed. That IS part of the same domain, but I kept getting an error – something about “credential delegation”. After some research, I ran across this post which explained (in much more detailed than I needed) how to fix this, you need to run:
PS> Enable-WSManCredSSP -Role Client -DelegateComputer “*.internal.example.com”
PS> Enable-WSManCredSSP -Role Server
Assuming “internal.example.com” is where the connecting (client) machine is, from where you want to administer the server. I kept getting errors unless I ran this on BOTH the client the server. I’m still not very clear on what this is, why it’s needed, and why it’s not enabled by default?
Oh, OK, so that’s it?
Well, no. I have some more bad news. I can connect now to the new, dedicated Hyper-V server. However, two things break consistently, and there is one bug to be aware of:
- Hyper-V GUI doesn’t refresh (bug): just FYI, whenever you do anything to a remote virtual machine, it doesn’t reflect in the GUI. You have to explicitly Refresh using the button in the right navigation of the Hyper-V Manager application. I’ll call this a bug because I wasted a LOT of time retrying things and researching because I thought that the change didn’t take affect – when it actually did.
- Creating a virtual switch: when I go to create a virtual switch, it hangs on the “Applying changes…” progress bar. It eventually times out and says it failed. It actually didn’t fail – you need to refresh and you’ll see it was successful. However, it didn’t notice that (like me), you’ll try this a few more times and keep getting errors and timeouts.
- Creating the VHD for a new machine: when you create a new virtual machine, when it goes to create the hard drive, it spins and spins (like above) and ultimately fails. It DID create the .vhd, but it’s not assigned to the VM. See below…
To fix this latter problem, wait several minutes while you see this screen (I assume it only takes seconds to complete though):
Well, I waited probably 2 minutes, clicked Cancel – and now the “New Virtual Machine Wizard” is frozen, and all I can do is click the Red X!
Back in Hyper-V Manager, it looks like it didn’t create the virtual machine – but the files are there out on disk. So, click “Refresh” on the right-side navigation:
and voila, the server actually WAS created. However, the hard drive and DVD are not connected. So, right-click on the newly-created VM and choose “Settings” – click on the “IDE Controller” (or SCSI Controller), and “Add” a hard drive, and simply navigate out to where the existing .vhd is:
and then for a DVD drive, do the same thing – and either map it to the physical DVD drive, or point to the .iso file for the operating system you are going to install:
Both of these steps are normally not needed, but since this interface is kind of buggy (and consistent), I thought I’d write down how I worked around it. If you don’t do those 2 steps, you’ll have a virtual machine with no hard drive and no DVD drive.
I sort of have mixed-feelings on this. The idea of having a minimalist server installation that JUST hosts VM’s, without any of the other overhead, or security vulnerabilities is great. However, this is not Linux – a command-line in Windows is like trying to work with your hands tied behind your back! It’s not minimalist – it’s an obstruction that makes it VERY difficult to administer the server!
With that said, if you can use a secondary machine to use the GUI tools, AND work around the bugs outlined below, the VM’s themselves seem to be stable. It’s just a little wonky when you first set up the VM. After that, it’s fine.
For me, since this is my preferred platform for hosting VM’s (Active Directory, Window Servers, my Windows 10 dev sandbox, Linux mail servers, other Linux sandboxes, etc) I want to try this for a few week and make sure all the kinks are worked out. If everything is good, I’ll switch my other VM host over to this too. This could be a good way to host VM’s on-the-cheap (which frees up a license), and still have all of the stability and easy tooling of Hyper-V.