30
Apr 13

Quick and Easy XenServer to Hyper-V Conversion

Lately I’ve been standing up more and more Hyper-V hosts – I’d estimate my environment is 80% virtual at this point with a total of 20 servers.

I had one remaining XenServer with about 4 VMs running on it.  I wanted an easy way to move these VMs to Hyper-V.  I tried using the XenCenter GUI to export to a workable format but that kept failing – unfortunately I don’t have any screenshots since this was done a while ago so the exact errors escape me.

This was tested on XenServer 5.6

My process was:

  • Decide where to export the converted virtual machines to.  I opted for an SMB share on a NAS, but you can easily adjust to save to a USB drive or to local storage, if you’d like.
  • Power down the virtual machine you’re moving
  • Log in to console, drop to shell on the XenServer host.
  • Install XenConvert on your Windows machine, link here
  • Export your VM using:

xe vm-export vm=VMNAME filename=/path/tofile/filename.xva>, preferably to a mounted share.  For example, xe vm-export vm=appserver1 filename = /mnt/export/appserver1.xva

  • Open the XVA in XenConvert and follow the prompts to convert it into an OVF.
  • Once the OVF is saved, browse to the folder. The VHD should be inside.
  • Create the machine in Hyper-V with the VHD attached. Remember to install Hyper-V guest additions and to check network settings.

That should be it!  This was the easiest way I found to convert virtual machines from XenServer to Hyper-V VHDs.


26
Apr 13

Disable Time Synchronization on All Virtual Machines

The scenario that started my day: One of my programmers complains of time-drift on his workstation. His machine has synced to a VM domain controller, which is odd, since it’s not the PDC, doesn’t hold any FSMO roles…I’ll figure that out later.

I recall reading about the time synchronization integration feature that Hyper-V has, and the problems it can cause with VM time settings. I want to query my Hyper-V server and see if the feature is enabled for any of the VMs.

Normally I’d pull up the Hyper-V Manager GUI, right click the VM, go to integration services, blahblahblah…

BUT

Lately I’ve been looking into more and more automation – the sentiment of “Work smarter, not harder” comes to mind. If you’re a Windows admin, this means your gonna have to crack your knuckles and launch into Powershell.

For some time I’ve dreamed of being a Powershell guru – I’ve always been jealous of the guys who bang out amazing one-liners in bash, creating miracles in strings.

Sure, I’ve “scripted” a bit. I know many can relate to this: putting scripts together can be a collage-type experience; that is, Googling each piece and pulling snippets from the various resources, a little regex from StackOverflow, some modification followed by trial and error from a Technet thread, a random tool pulled from some guy’s blog.

But more and more I want to learn the tools and syntax so I can do things my way first and only ask for help later.

I’ll assume:

  • You already have RSAT tools installed/enabled on whatever machine you’re connecting from
  • You understand the terrible oversight of Microsoft to only allow 2012 management tools to be installed on Windows 8.
  • Additionally, these tools don’t allow backwards compatibility, so if you’re still using a 2008/2008 R2 HV server, you’ll need Win 7 or Server 2008 to connect via a GUI or cmdlet.

My goals:

  • Find all servers which have time sync enabled as a Hyper-V integration feature.
  • Disable feature on all servers

Note:  I’ve only tested this from my Windows 8 machine connecting to my 2012 Hyper-V server.

Open up Powershell and run:

Import-Module Hyper-V

Next, run:

1
Get-VMIntegrationservice -Name 'Time Synchronization' -ComputerName HYPERVHOST -vmname *

This cmdlet queries your HV host for the Time Synchronization feature and accepts the * wildcard for VMname, listing the features status on all VMs.

Ready to turn the feature off?

1
Disable-VMIntegrationService -name 'Time Synchronization' -Computername HYPERVHOST -Vmname *

Same idea, but instead of a query, this cmdlet disables the feature. You can run the previous command to confirm it’s now disabled on all machines.

That’s it?  Yup.  Quick and easy.


15
Feb 13

Hyper-V 2008 R2 Virtual Switch Issues

Just came across an issue in Hyper-V:  I was making changes to a network adapter’s binding in Hyper-V manager under the Virtual Network Manager when MMC crashed, closing out Hyper-V manager.  Upon reopening, trying to bind the virtual switch to an External Adapter resulted in the following error:

[Window Title]
Virtual Network Manager

[Main Instruction]
Error Applying New Virtual Network Changes

[Content]
Setup switch failed.

Cannot bind to ‘HP NC373i Multifunction Gigabit Server Adapter #8’ because it is already bound to another virtual network.

[Close]

Searching the error resulted in the following KB, KB2486812:

http://support.microsoft.com/kb/2486812

Essentially, download the NVSPbind tool and extract it.  Copy the EXE to your server, run it with no switches to list all adapters.  nvspbind no switches

The format is:

{6B360F51-C6C4-4EA0-AFEF-E4D1056B498E}
“pci\ven_14e4&dev_1600&subsys_3015103c”
“Friendly NIC Name”
“Local Area Connection”:
disabled: ms_netbios       (NetBIOS Interface)
disabled: ms_server        (File and Printer Sharing for…

After finding the offending adapter, run:

nvspbind /u Friendly NIC Name

 

This will scrub the binding and allow you to try again via the GUI or Powershell.