Problem solve Get help with specific problems with your technologies, process and projects.

How to convert VMware virtual disk images to Virtual Server

In this tip, Chris Wolf explains how to convert VMware virtual disk imagesto Microsoft Virtual Server when you don't have the resources to buy Platespin's PowerConvert.

Migrating virtual machines can be a tricky business, depending on the circumstances. With its relatively low price, Platespin's PowerConvert is a no-brainer for major migrations. But what happens when you need to convert virtual disks but don't have the budget for PowerConvert?

If you need to convert Microsoft (.vhd) virtual disks to VMware (.vmdk) virtual disks, you can use VMware's Virtual Machine Importer, a free download. For converting VMware virtual machines (VMs) to Virtual Server or Virtual PC, the only free resource from Microsoft is the Virtual Server Migration Toolkit (VSMT).

But because VMST has a number of cumbersome requirements, including Microsoft Automated Deployment Services (ADS), many administrators prefer to seek another way.

In this article, we'll describe an alternative method you can use to migrate VMware virtual machines to Virtual Server. Part one will discuss preparing the source VM for the migration, and part two will discuss how to prepare the FTP server, clone the source VM and prepare the target VM.

Here's what you need:

  • Disk imaging software such as Symantec Ghost. For those who do not have Ghost, this article outlines the creation and deployment of an image using the open source Ghost for UNIX (G4U). I tested the procedures using both Symantec Ghost and G4U. With G4U, the image deployment to the new Virtual Server VM was twice as fast as with Symantec Ghost, which was very surprising.
  • FTP Server for upload and storage of cloned image (if using G4U).
  • Windows Setup CD or latest installed service pack files for VM OS to be migrated.
  • The script prepvm.vbs, which is used to disable services and drivers that may prevent the migrated VM from booting successfully.

Imaging and redeploying a VMware VM as a Virtual Server VM can be relatively painless, as long as you remove the unnecessary drivers and services and replace the existing Hardware Abstraction Layer (HAL) driver with a generic HAL.

Keeping the target hard disk configuration the same as the source VM disk configuration will ensure that the boot.ini file will not need to be modified prior to cloning the VM.

Now let's look at the migration process.

Preparing the source VM

The most important part of the imaging process is preparing the source VM. This should ensure that the new VM, when deployed to Virtual Server, will not blue screen or fail to start.

As a safeguard, this procedure will use my prepvm.vbs script to disable any possible leftover VMware drivers that could cause Windows startup to hang on the new VM. Here is the script:

 'prepvm.vbs 'Removes VMware-specific drivers from a system On Error Resume Next ' Instantiate Shell Object Set objShell = CreateObject("WScript.Shell") ' Disable VMware Tools Service objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\VMTools\\Start", _ 4, "REG_DWORD" ' Disable VMware vmx_svga video driver objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\vmx_svga\\Start", _ 4, "REG_DWORD" ' Disable VMware vmmouse driver objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\vmmouse\\Start", _ 4, "REG_DWORD" ' Disable VMware vmscsi driver objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\vmscsi\\Start", _ 4, "REG_DWORD" ' Disable VMware PCnet driver objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\PCnet\\Start", _ 4, "REG_DWORD" ' Disable VMware Buslogic driver objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\buslogic\\Start", _ 4, "REG_DWORD" ' Disable SCSI Miniport drivers objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\symc810\\Start", _ 4, "REG_DWORD" objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\symc8xx\\Start", _ 4, "REG_DWORD" objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\cpqarray\\Start", _ 4, "REG_DWORD" objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\pcntn4m\\Start", _ 4, "REG_DWORD" objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\cpqnf3\\Start", _ 4, "REG_DWORD" objShell.RegWrite "HKLM\\SYSTEM\\CurrentControlSet\\Services\\MRaidNT\\Start", _ 4, "REG_DWORD" ' Restart Computer strComputer = "." 'Prompt user of impending reboot WScript.Echo("The system is prepared for imaging and will now shutdown.") WScript.Sleep(3) Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate,(Shutdown)}!\\\\" & _ strComputer & "\\root\\cimv2") Set colOperatingSystems = objWMIService.ExecQuery _ ("Select * from Win32_OperatingSystem") For Each objOperatingSystem in colOperatingSystems objOperatingSystem.Shutdown() Next

To prepare the source VM, follow these steps:

  1. Create a backup copy of the VM and work with the backup copy for the remainder of this process. Preparing the backup for cloning ensures that, if an error occurs during the cloning process, the source VM will still be available.
  2. Boot up the backup copy of the source VM and login. Copy the prepvm.vbs script to the VM, but do not run it at this point.
  3. Use Add/Remove Programs to uninstall the VMware Tools. When prompted, reboot the VM.
  4. Log back in to the VM. If the Found New Hardware Wizard opens after you login, cancel the wizard. If prompted to reboot, click No.
  5. Check the service pack level of the system. If no service pack is installed, you will need the OS Setup CD for this step. If a service pack is installed, then you will need access to the service pack setup files (extracted and on a CD, saved locally, or accessible via the network).

    Note that it is extremely important that the files you copy match the OS/Service Pack version. Copying older file versions (such as from the Setup CD when the OS has already reached a specific service pack level) may render the system unable to boot.
  6. Open the command prompt window.
  7. To refresh to the default HAL, run this command (assumes Service Pack or Setup CD-ROM has the drive letter D):
    expand d:\\i386\\hal.dl_ %windir%\\system32\\hal.dll

    Note that if you are copying files from the %windir%\\system32\\servicepackfiles folder (assuming SP backup files were copied locally to the system's hard disk during the service pack installation), you will just copy the servicepackfiles\\i386\\hal.dll file to the %windir%\\system32 folder.
  8. Replace the current ntoskrnl with the default by running this command:
    expand d:\\i386\\ntoskrnl.ex_ %windir%\\system32\\ntoskrnl.exe

    Note that if you are copying files from the %windir%\\system32\\servicepackfiles folder (assuming SP backup files were copied locally to the system's hard disk during the service pack installation), you will just copy the servicepackfiles\\i386\\ntoskrnl.exe file to the %windir%\\system32 folder.
  9. Now run the prepvm.vbs script. The VM will now shut down and is ready to be imaged.

With the source VM ready to go, you're just about ready to start the imaging process.

In part two, we'll discuss how to prepare the FTP server, clone the source virtual machine and then prepare the target VM.

About the author: Chris Wolf, MCSE, MCSE, MCT, CCNA, is a Microsoft MVP for Windows Server-File System/Storage and the Computer and Information Systems Department Head for the ECPI College of Technology online campus. He also works as an independent consultant, specializing in the areas of virtualization, enterprise storage, and network infrastructure management. Chris is the author of Virtualization: From the Desktop to the Enterprise (Apress), Troubleshooting Microsoft Technologies (Addison Wesley) and he is a contributor to the Windows Server 2003 Deployment Kit (Microsoft Press).

Dig Deeper on VMware virtualization