Jaa


Using OVF Packages to Create Virtual Machines in System Center Virtual Machine Manager 2012

 

Updated: May 13, 2016

Applies To: System Center 2012 - Virtual Machine Manager

The Open Virtualization Format (OVF) is a packaging standard from Distributed Management Task Force, Inc., designed to facilitate portability and deployment of virtual appliances. In Virtual Machine Manager (VMM) in System Center 2012, you can use an OVF package to create a virtual machine by using the OVF Import/Export tool. However, as of Virtual Machine Manager in System Center 2012 Service Pack 1 (SP1), the OVF tool is not supported. Instead, to import and to export an OVF package to Hyper-V, use the Microsoft Virtual Machine Converter (MVMC), which converts the VMDK/VHD file. For more information, see Microsoft Virtual Machine Converter 3.0.

When you work with OVF packages, the name of the virtual hard disk that is specified in the .ovf file must match the actual path and name of the virtual hard disk. If you convert a file from, for example, .vmdk to .vhd, or if you rename the virtual hard disk file, you must also edit the .ovf file to update the name.

Note the following:

  • If you plan to convert a virtual hard disk from one format to another, such as from .vhd to .vmdk or from .vmdk to .vhd, we recommend that you use the fixed size disk format. A fixed size disk is also known as a "thick disk."

  • The virtual hard disk name appears more than once in the .ovf file. Ensure that you update all instances of the name.

  • The current version of the OVF tool supports a single virtual machine. The import and export of VMM service templates containing more than one virtual machine or with deployment customizations are not currently supported.

Creating Virtual Machines from OVF Packages

As of Virtual Machine Manager in System Center 2012 Service Pack 1 (SP1), the OVF tool is not supported. Instead, to import an OVF package to a Hyper-V host, you can use the Microsoft Virtual Machine Converter (MVMC), which converts the .vmdk file to a .vhd file. By using MVMC, the metadata in the OVF package is lost, so you must capture information, such as the virtual machine hardware configuration, before you create a new virtual machine from the converted virtual hard disk. For more information about MVMC, see Microsoft Virtual Machine Converter 3.0 on TechNet.

To convert an OVF package into a virtual machine

  1. Open the descriptor in the OVF package and note the virtual machine metadata, such as the virtual machine hardware configuration.

  2. Use Microsoft Virtual Machine Converter (MVMC) to convert the .vmdk file to a .vhd file.

  3. Use VMM to create a virtual machine from the virtual hard disk; use the original metadata that you noted from the OVF package, as applicable. For more information, see How to Create and Deploy a Virtual Machine from an Existing Virtual Hard Disk.

Using the OVF Tool to Import and Export Virtual Machines

The OVF Import/Export tool consists of Windows PowerShell cmdlets that enable users of System Center 2012 – Virtual Machine Manager (VMM) to import and export virtual machines that are packaged in the OVF format. You can use the OVF tool to import a virtual machine from other virtualization platforms (currently, these are VMware vCenter and Citrix XenServer) or to export a virtual machine for use on another platform.

The OVF format uses an XML file with the extension .ovf together with one or more virtual disks. The OVF Import/Export tool does not convert virtual hard disk file formats. You might require third-party tools to convert a virtual hard disk format.

Installing the OVF Import/Export tool

You can download the OVF Import/Export tool from the Microsoft Download Center. The OVF Import/Export tool is distributed as a Windows Installer package. You must install the tool on an existing VMM management server that has the VMM console installed. The package installs a Windows PowerShell snap-in that contains the following cmdlets:

  • Export-SCVirtualMachine

  • Import-SCVirtualMachine

To install the OVF Import/Export tool, double-click the Windows Installer package SC2012_VMM_OVFImport-Export.msi. You must accept the license terms and select an installation folder. Complete the installation.

Before you use the cmdlets in the VMM command shell, you must add the Windows PowerShell snap-in to your current Windows PowerShell session. To add the snap-in, run the cmdlet Add-PSSnapin OVFToolSnapIn.

If you start a new Windows PowerShell session by opening a new instance of the VMM command shell, you must run the Windows PowerShell cmdlet in that session before you can use the OVF Import/Export cmdlets.

Note

If you use a profile, add the cmdlet Add-PSSnapin OVFToolSnapIn to your profile to load the Windows PowerShell snap-in automatically. For more information, type get-help about_profiles.

Importing a virtual machine

Use the Import-SCVirtualMachine cmdlet to create a new virtual machine for VMM by using the .ovf file and virtual hard disks in a specified location. The cmdlet creates a new virtual machine with the referenced virtual hard disk and stores it in a VMM library share. Self-service users must specify a writable share for the virtual machine. Note the following:

  • Before you import an OVF package to VMM with the OVF Import/Export tool, verify that the virtual hard disk format is .vhd or .vhdx, or convert it to be .vhd or .vhdx. Ensure that you use the fixed size disk format.

  • If the original virtual machine is joined to a logical network, the import process tries to join the imported virtual machine to a logical network with the same name, if such a network exists. Otherwise, the virtual machine is not joined to a network.

The Import-SCVirtualMachine cmdlet has several key parameters.

Import parameter Required? Description
ImportVMPath Yes Specifies the path of the OVF descriptor file to be imported.
LibraryServerObject Yes Specifies the library server object that is associated with the library share.
VMMServerObject Yes Specifies the VMM management server.
LibrarySharePath Yes Specifies the library share.
VHDSourcePath Yes Specifies a local path for the virtual hard disk. Specify multiple instances for virtual machines with more than one virtual hard disk.
VMName Yes Specifies a name for the new virtual machine.
AllowUnencryptedTransfer Switch Specifies whether Unencrypted Bits transfer is allowed.
Overwrite Switch Specifies whether export files overwrite existing files.

The following example commands create and store a virtual machine that is named MyVirtualMachine.

  
$vmm = get-scvmmserver -ComputerName "MyVMM"  
$ls = Get-SCLibraryServer -ComputerName "MyLibraryServer"  
Import-SCVirtualMachine -ImportVMPath "C:\Test\MyVirtualMachineOVF.ovf" -LibraryServerObject $ls -VMMServerObject $vmm -LibrarySharePath "\\MyLibraryServerFQDN\MSSCVMMLibrary\Import\" -VHDSourcePath "C:\ImportInVMM\MyVirtualMachineVHD.vhd" -VMName "MyVirtualMachine"  
  

The first command gets the VMM management server. The second command gets the library server. The third command creates a virtual machine with the specified name by using the specified .ovf file and disk, and then stores it in the specified library share.

Exporting a virtual machine

Use the Export-SCVirtualMachine cmdlet to create an OVF package together with the virtual hard disk for a virtual machine. The virtual machine that you want to export must be stored in the library. The cmdlet saves the exported files in a specified local directory.

The Export-SCVirtualMachine cmdlet has several key parameters.

Export parameter Required Description
ExportPath Yes Specifies a local path for exporting the OVF files.
StoredVMObject Yes Specifies the stored virtual machine object to be exported.
TargetVirtualizationPlatform Yes Specifies the platform for export: vmm, vcenter, or xen.
VMMServerObject Yes Specifies the VMM management server.
AllowUnencryptedTransfer Switch Specifies whether Unencrypted Bits transfer is allowed.
Overwrite Switch Specifies whether export files overwrite existing files.
ExportOnlyOVF Switch Specifies whether to export only the .ovf file without a virtual hard disk file.

The following example commands export a virtual machine that is named MyVirtualMachine.

  
$vmm = get-scvmmserver -ComputerName "MyVMM"  
$vm = get-scvirtualmachine -name "MyVirtualMachine"  
Export-SCVirtualMachine -ExportPath "C:\ExportDir" -StoredVMObject $vm -TargetVirtualizationPlatform ”<supportedPlatform>”  -VMMServerObject $vmm  
  

The first command gets the VMM management server. The second command gets the virtual machine object. The third command exports the virtual machine in the form of an OVF package to the local export path.