Hyper-V and SCVMM

Best Practice: Move Windows Server VM from vSphere to SCVMM (2012 R2)

Due to the removal of P2V wizard in SCVMM 2012 R2, we need to to this migration manually.

In this scenario, we will move a Windows Server VM hosted in vSphere/ESXi 6 to SCVMM/Hyper-V 2012 R2.
We need:

  • Administrator account with password of the VM to be moved.
  • A working SCVMM 2012 R2 with Hyper-V, and the client tool for management.
  • A working vSphere 6 with ESXi, and the client tool for management.
  • A network shared folder which can be accessed with read-write permission by VM, Hyper-V (optional) and the computer which the client tool of SCVMM located.

Here are the steps:

  1. Download the tool disk2vhd from https://technet.microsoft.com/en-us/sysinternals/ee656415.aspx and decompress it into the network shared folder.
  2. Log into the VM, check these settings:
    IP Address. If it’s set to automatic, make announce to your network admin to either set the VM to fixed IP address, or rebinding the MAC address later.

    • System CPU and memory.
    • OS Release name and bit wide, e.g. Windows Server 2008 Standard 32bit.
    • Hard disks and partitions structure.
  3. Run the disk2vhd at the network shared folder from VM. I suggest you not to copy it to the VM. All partitions which belong to the same hard disk should be exported to the same file at the SAME time. And all partitions from different disk should NOT be in the same exported file.
    For the VM running Windows Server 2003 (R2 included, x86 x64 included), do NOT check the option for virtual-pc. It will prevent the success from installing Hyper-V integration services.
    This step may take a while.
  4. Create a new VM in SCVMM by using the correct name, CPU, memory, OS release name. For my test, I cannot create a VM without hard drive. So just delete it after the creating finished.
  5. Copy the file(s) created from step 3 into the folder of the new VM.
    Due to the Windows bug of calculating free space of the host drive instead of the cluster volume disk, you may be prompted with an error said no enough disk space left for the VHD files.
    In this case, you need to execute the copy from Hyper-V, not form another computer. If your Hyper-V is installed without the full OS, aka Windows Hyper-V Server, you may have to do this by using cmd. The command for mapping a network shared folder as a driver is:

    net use x: \\path\to\your\shared\folder

    If you need to specify the account for accessing that folder:

    net use x: \\path\to\your\shared\folder password /User:domain\account

    After VHD files copying, use this to unmap the folder:

    net use x: /d

  6. Adding the VHD files to the new created VM by correct sequence.
  7. Shutdown the old VM and boot the new one.
  8. Log into the new VM, uninstall the VMware tools and shutdown the OS. If your VM is using Windows Server 2003 and you are using Remote Desktop to access SCVMM, now you have to use keyboard to finish this job.
  9. Install Hyper-V integration services. For Windows Server 2012 and above, it’s optional but recommended. For Windows 2008 R2 and previous, it’s necessary.
  10. Start the VM again and set the IP addresses of network interface cards.
  11. Mark or remove the old VM for avoiding conflicts.

Hope this work-though helps.

Enable Remote Management for Hyper-V Server

After a clean installation process, firewall of Hyper-V Server is set to deny any remote connection by default.

If you need to management other than using console, you may want to enable inbound rules for Remote Management and Remote Desktop by running these commands in the console.

To enable the Remote Management:

cscript C:\windows\system32\scregedit.wsf /im 1

To enable the Remote Desktop:

cscript C:\windows\system32\scregedit.wsf /ar 0

And, you need to enable the remote desktop from the sconfig (the blue console window) also.

AVMA: An easier way to activate Windows Server 2012 R2 in Hyper-V

Microsoft provides a new way to activate VMs hosted in Hyper-V, named Automatic Virtual Machine Activation (AVMA). It makes the activation step of VMs much easier.

Requirement:

  • Hypervisor: Windows Server 2012 R2 Datacenter with Hyper-V role. Other versions are not supported. Dedicated Hyper-V Server is not supported.
  • VM: Windows Server 2012 R2 Datacenter, Standard and Essentials.

Steps:

  1. Prepare and activate your Hypervisor;
  2. Install supported OS as VM with the key listed below, or change the key of an installed VM with command “slmgr /ipk <key>”.

Keys:

  • Windows Server 2012 R2 Datacenter: Y4TGP-NPTV9-HTC2H-7MGQ3-DV4TW
  • Windows Server 2012 R2 Standard: DBGBW-NPF86-BJVTX-K3WKJ-MTB6V
  • Windows Server 2012 R2 Essentials: K2XGM-NMBT3-2R6Q8-WF2FK-P36R2

These keys are supported to being used in any unattend.exe setup file also.

 

Source: http://technet.microsoft.com/en-us/library/dn303421.aspx

Shutdown firewall of Hyper-V Server

After deployment of Hyper-V Server, I trapped in trouble of  linking Hyper-V Server to SCVMM.

Finally, I find a way to shutdown firewall of Hyper-V Server, which helps me resolved the problem.

  1. Log on to Hyper-V Server;
  2. Type this into cmd window:
    netsh advfirewall set allprofiles state off

Enable Jumbo Frame on Hyper-V Server

I have some hyper-v servers with broadcom NICs. Due to lack of UI (device manager and property window of NIC), it’s not easy to enable Jumbo Frame (MTU9000) setting.

After a google dig and some experiment, I find a way to achieve that.

  1. Install BACS (Broadcom Advanced Control Suite). You may want to use this tool for creating team also. Remember the 4-digit number within brackets before the NIC you want to change MTU.
  2. Open regedit, expand HKEY_LOCAL_MACHINE\CurrentControlSet\Control\Class\4D36E972-E325-11CE-BFC1-08002BE10318}\(4-digit-number-of-NIC) on the left panel, you will get a value named “*JumboMTU” on the right. Change it to 9014 or any other value you need.
  3. Type this command “netsh int ipv4 sh int” to list all network. Remember the Name of the connection you want to change MTU.
  4. Type this command to change it to 9000 or any other value. The value should be the value you’ve set in step 2, minus 14:
    netsh interface ipv4 set subinterface “Connection Name” mtu=9000 store=persistent
  5. Reboot to apply.