I believe in Hyper-V!

Windows ServerCategory Archives

Hyper-V Replica [test environment]

In one of my latest post I wrote about how to install Hyper-V role inside Hyper-V virtual machine. Many of my colleagues asked me, why you do that? Actually, I have two answers. The first is: I don’t have free hardware in my company for testing purposes, and the second is; for my lectures/demos on various conferences when I talk about Hyper-V Replica (not only about Hyper-V Replica). When I have test environment on my laptop I’m pretty sure that demos will work.
So, let’s go back to the title. In one of my demos I need to do Hyper-V Replica between two Hyper-V hosts and you can see step-by-step guide in the pictures and short explanations below.

1. In this test environment I want replicate VM RHV from Hyper-V host called WD2012CORE to Hyper-V host called Hyper-VReplica. The procedure is straight forward, just follow the wizard :). Select VM which you wont replicate and select Enable Replication.

1
2

Choose on which Hyper-V host you want replicate your VM’s. As I mention before, I replicate from WS2012CORE to Hyper-VReplica Hyper-V host.

3
4

Under the Specify Connection Parameters tab can choose Authentication Type. Be default wizard offers us Kerberos authentication (HTTP), but we can use certificate-based authentication (HTTPS) if we wont secure transmission between Hyper-V hosts. Of course, if you want use certificate based authentication need to have certificate. But considering that this is test environment I chose Kerberos authentication.

5 

On the next tab select virtual disk location and click Next

6 

In my case I chose option Only the latest recovery point, but in production environment we need to have another plan, depends of your needs.

7

When you go to Choose Initial Replication Method can choose three ways how want to transfer initial copy to Hyper-V Replica server. In my case I chose option Send initial copy over the network. For my production environment is very interesting to use option Send initial copy using external media. Why this is a good solution? For example; if have very big virtual machines (I mean on big capacity) than you can send initial copy on an external media (external HDD) and take it to a remote location. In this case, does not overload the network resources if you have slow connection between two locations, like I have.

8

At the end check parameters on Summary and click Finish.
9

Log on Hyper-V Replica server and will see your replicated Hyper-V virtual machine.
10

If you want to check replica status right click on VM and you will be see Replication Health for replicated VM.
11

All above we do through GUI, but I like do that with PowerShell. So, how to replicate VM with PowerShell from Hyper-V host to Hyper-V Replica server you can see below.

PowerShell 3.0 includes 22 Cmdlets for configuring, enabling, monitoring, and managing Hyper-V Replica on an automated basis. This time I’ll be just write PS script for above mentioned example. I one of my next blog post I’ll be describe how to use PowerShell for Hyper-V Replica step-by-step.

So, in this example I replicate virtual machine WinDays13 from Hyper-V host WS2012CORE to Hyper-V host Hyper-V Replica. First I need to enable Hyper-V Replica on Hyper-V host.

1

And the second I need to enable replication for virtual machine.

2

Voila! VM WinDays13 is replicated.

3

At the end of this article I’d like to mention one very important thing! Hyper-V Replica isn’t BACKUP! We use Hyper-V Replica for a DISASTER RECOVERY.

It’s Monday, let’s get to work.

Cheers,

Romeo.

Add external USB hard drive to Hyper-V virtual machine

In this blog post I’ll describe how to add external USB hard drive to Hyper-V virtual machine.
In my case I have an external WD USB hard drive with 500GB capacity and I want add that drive into my Hyper-V virtual machine.

NOTE: As you probably know, removable usb drives is not supported in Hyper-V.

This is a short “how to”:

1. On your Hyper-V host open Disk Management.
2. Choose external USB hard drive and right click on him.
 1
3. Click on Offline.
2

4. Open Settings on virtual machine to which you want to add external USB drive and select SCSI Controller on the left hand side, select Hard Drive, and click Add on the right hand side.
3

5. Check mark Physical hard disk: , select external USB hard drive na click OK.
4

6. Logon into VM and open Disk Management. Click on newly attached Disk and bring him Online.
5 

Open Windows Explorer and you will see your external USB hard drive ;)
6

Enjoy in day ;)

Converting WS2012 Core to a WS2012 with GUI and vice versa.

In the last few weeks I installed several Hyper-V hosts in my production environment. On every host I installed WS2012 Core with Hyper-V role. Why? Because I don’t need anything on that hosts except Hyper-V role, but, what if I’ll ever need something more than Hyper-V role? What if I’ll ever need WS2012 with GUI on that hosts?
In order to be ready for something like that, I decided to try on one of the test servers, and I would like to explain how to convert your installed WS2012 Core to a WS2012 “full” version (with GUI) and vice versa.

Follow this few steps:

1. Create a directory where Windows image will be mounted

MkDir MountDir
1

2. Determine the index number for a Server with a GUI image

Dism /get-wiminfo /wimfile:D:\sources\install.wim
2

3. Mount the WIM file using this command:

Dism /mountwim /WimFile:D:\sources\install.wim /Index:4 /MountDir:
c:\mountdir\readonly

3

4. On the last step, start PowerShell, then execute the following command;

a) PowerShell (press enter)
4
b) Install-WindowsFeature Server-Gui-Mgmt-Infra,Server-Gui-Shell –Restart –Source C:\mountdir\windows\winsxs
5 
6 
7

Now we have WS2012 with GUI installed!
 

8

If we want Core version of WS2012 we can do that through PowerShell! All you need to do is to execute the following command at an elevated Windows PowerShell:

Uninstall-WindowsFeature Server-Gui-Mgmt-Infra
9
10 
11

Now, again we have WS2012 Core ;)

14

Enjoy in this beautiful day :)