VMM: How to Convert a VMWare Image to VHD


The following is an excerpt from the cmdlet reference for VMM Beta 2 (requires registration and Windows Live ID log on):


New-V2V


   


SYNOPSIS


    Converts a virtual machine created in VMware(R) to a Virtual Server-based v


    irtual machine managed by Virtual Machine Manager.


   


   


SYNTAX


    New-V2V -Path <String> -SourceComputerName -VMHost -VMXPath [-DelayStart] [


    -Description <String>] [-JobVariable <String>] [-MemoryMB <Int32>] [-Name <


    String>] [-Owner <String>] [-ProcessorCount] [-ProcessorSpeed] [-ProcessorT


    ype] [-RunAsSystem] [-RunAsUserCredential] [-RunAsynchronously <Boolean>] [


    -StartAction] [-StopAction] [-UseHardwareAssistedVirtualization] [-VMMServe


    r] [<CommonParameters>]


   


    New-V2V -MachineConfig <MachineConfiguration> -Path <String> -VMHost -VMXPa


    th [-DelayStart] [-Description <String>] [-JobVariable <String>] [-MemoryMB


     <Int32>] [-Name <String>] [-Owner <String>] [-ProcessorCount] [-ProcessorS


    peed] [-ProcessorType] [-RunAsSystem] [-RunAsUserCredential] [-RunAsynchron


    ously <Boolean>] [-StartAction] [-StopAction] [-UseHardwareAssistedVirtuali


    zation] [-VMMServer] [<CommonParameters>]


   


   


DETAILED DESCRIPTION


    Converts a VMware Server-based virtual machine to a Virtual Server-based virtual machine managed by Virtual Machine Manager. The source for a V2V conversion of a VMware virtual machine is a set of files that are stored in the Virtual Machine Manager library:


   


    * A .vmx file, which is a VMware virtual machine configuration file.


   


    * Several .vmdk files, which are VMware virtual hard disks that contain


      the virtual machine’s guest operating system.


   


    During the conversion process, the New-V2V cmdlet converts the .vmdk files


    to .vhd files and modifies the guest operating system.


   


    New-V2V supports the conversion of VMware virtual machines with any of the


    following guest operating systems: Microsoft Windows 2000 Server with Servi


    ce Pack 4 (SP4) or later, Windows Server 2003 SP1 or later, or Windows Serv


    er 2003 R2. A V2V conversion requires that the host on which the new virtua


    l machine will be deployed is a computer running Virtual Server R2 SP1 or l


    ater.


   


    Some conversions might require that additional files be added to the intern


    al cache. You can use the Add-Patch cmdlet to add the required files to the


     cache.


   


 


PARAMETERS


    -Path <String>


        Specifies the destination path for the operation. Examples formats incl


        ude:


       


        – Path “<DriveLetter>:\”


        – Path “<DriveLetter>:\<FolderName>


        – Path “\\Library\Templates


        – Path “\\MyLibrary1\MyVMs” | where {$_.Path -eq “Managed Computers\MyG


        roup\”}


       


    -VMHost


        Specifies a virtual machine host object or an array of host objects. A


        host is a computer managed by Virtual Machine Manager on which you can


        deploy one or more virtual machines.


       


    -VMXPath


        Specifies the full path to the .vmx file of the VMware virtual machine.


       


    -DelayStart


        Specifies the number of seconds to wait after the Virtual Server servic


        e is started before automatically starting a virtual machine. This sett


        ing is useful when multiple virtual machines are configured to start au


        tomatically because you can stagger the startup to help reduce the dema


        nd on the physical computer’s resources when multiple virtual machines


        start simultaneously. The amount of time that you should specify depend


        s on your hardware; however, a typical setting would be in the range of


         30 to 60 seconds. The maximum amount of time you can specify is 86,400


         seconds, which is 24 hours.


       


    -Description <String>


        Specifies a description for a Virtual Machine Manager object.


       


    -JobVariable <String>


        Specifies that job progress is tracked and stored in the variable named


         by this parameter. This parameter is often used in conjunction with th


        e RunAsynchronously parameter.


       


    -MemoryMB <Int32>


        Specifies, in megabytes (MB), the total amount memory on the host that


        is assigned to a virtual machine. You can specify values in the range f


        rom 4 MB up to 3712 MB. The maximum recommended value is 3340 MB.


       


    -Name <String>


        Specifies the name of a Virtual Machine Manager object.


       


    -Owner <String>


        Specifies the owner of a Virtual Machine Manager object.


       


    -ProcessorCount


        Specifies the number of CPUs on a virtual machine, on a hardware profil


        e, or on a template in a Virtual Machine Manager environment. In the cu


        rrent release, the value is 1 because Virtual Machine Manager supports


        only one CPU in a virtual machine.


       


    -ProcessorSpeed


        Specifies, in gigahertz (GHz), the amount of processing speed on the ho


        st that this virtual machine requires.


       


    -ProcessorType


        Specifies the type of processor on the host that can be used by a virtu


        al machine. You can use the Get-ProcessorType cmdlet to see a list of t


        he available types of processor.


       


    -RunAsSystem


        Specifies that a virtual machine will run under the local system accoun


        t. Setting this account means that Virtual Server will not automaticall


        y start the virtual machine when the Virtual Server service starts. (Al


        ternatively, you can use the RunAsUserCredential parameter to specify t


        hat the virtual machine run under a guest account and that the virtual


        machine start when the Virtual Server service starts.)


       


    -RunAsUserCredential


        Specifies the guest account (domain\account) that the virtual machine r


        uns under. If you do not specify a user account, the virtual machine ru


        ns under the account of the user who starts the virtual machine. Runnin


        g a virtual machine under a user account enables Virtual Server to auto


        matically start a virtual machine when the Virtual Server service start


        s.


       


        For enhanced security, you can create a special account for this purpos


        e that has a low level of permissions. The minimum permissions required


         for this account are as follows:


       


        * On the .vmc file: Read Data, Write Data and Execute File


       


        * On the .vhd file: Read Data, Read Attributes, Read Extended


          Attributes, and Write Data


        


        * On the .vnc file if a virtual machine is connected to a virtual


          network: Execute File, Read Data, Read Attributes and Read


          permissions


       


        * On the folder that contains the .vmc file, for a virtual machine to


          have the ability to save state: List Folder and Write/Create File


       


        Alternatively, if you do not want Virtual Server to start the virtual m


        achine automatically when the Virtual Server service starts, you can us


        e the RunAsSystem parameter to run the virtual machine under the local


        system account.


       


    -RunAsynchronously <Boolean>


        Specifies that the job created by a command will run asynchronously so


        that control returns to the shell immediately. This parameter is often


        used in conjunction with the JobVariable parameter.


       


    -StartAction


        Specifies the behavior of a virtual machine when Virtual Server starts.


         The options are:


       


        -StartAction AlwaysAutoTurnOnVM


        -StartAction NeverAutoTurnOnVM


        -StartAction TurnOnVMIfRunningWhenVSStopped


       


        IMPORTANT: If you want to specify that the virtual machine starts autom


        atically when Virtual Server starts, you must also use the -RunAsUserCr


        edential to specify an account with appropriate permissions. If you do


        not specify a user account, the StartAction reverts to NeverAutoTurnOnV


        M.


       


    -StopAction


        Specifies the behavior of the virtual machine when Virtual Server stops


        . The options are:


       


        -StopAction SaveVM


        -StopAction TurnOffVM


        -StopAction ShutdownGuestOS


       


    -UseHardwareAssistedVirtualization


        Specifies that hardware-assisted virtualization is used if it is availa


        ble (when set to TRUE) or not used (when set to OFF). Hardware-assisted


         virtualization is a feature introduced with Microsoft Virtual Server 2


        005 R2 SP1.


       


    -VMMServer


        Specifies the object that represents a Virtual Machine Manager server.


       


        A Virtual Machine Manager server provides the Virtual Machine Manager d


        atabase and enables you to manage host servers (which host virtual mach


        ines) as well as library servers (which store Virtual Machine Manager l


        ibrary resources). The Virtual Machine Manager database is stored eithe


        r in Microsoft SQL Server on the Virtual Machine Manager itself or on a


        nother server running Microsoft SQL Server.


       


    <CommonParameters>


        This cmdlet supports the common parameters: -Verbose, -Debug,


        -ErrorAction, -ErrorVariable, and -OutVariable. For more information,


        type, “get-help about_commonparameters”.


   


    EXAMPLE 1: Convert a VMware-based virtual machine to a Virtual Server-based


     virtual machine.


   


    PS C:\> Get-VMMServer -ComputerName “VMMServer1.Contoso.com”


    PS C:\> $VMHost = Get-VMHost -ComputerName “VMHost01.Contoso.com”


    PS C:\> New-V2V -VMXPath “C:\VMware\SourceVM.vmx” -VMHost $VMHost -Name “VM


    01″ -Path “C:\MyVMs” -MemoryMB 256 -RunAsynchronously


   


    The first command connects to VMMServer1 in the Contoso.com domain and retr


    ieves the server object from the Virtual Machine Manager database. The foll


    owing commands use this server by default.


   


    The second command gets from the Virtual Machine Manager database the objec


    t that represents the virtual machine host named VMHost01 (in the Contoso.c


    om domain) and stores the host object in variable $VMHost.


   


    The last command creates a Virtual Server-based virtual machine named VM01


    from the source VMware virtual machine whose .vmx file is located at C:\VMw


    are\SourceVM.vmx and deploys the new virtual machine on the C: drive of VMH


    ost01 in the MyVMs folder. The command assigns 256 MB of memory on the host


     for use by the new virtual machine. The -RunAsynchronously parameter retur


    ns control to the shell immediately (before the command completes). In this


     example, all of the virtual disks on the source virtual machine will be co


    nverted and attached to the new virtual machine.


   


   


   


REMARKS


    For more information, type: “get-help New-V2V -detailed”.


    For technical information, type: “get-help New-V2V -full”.