Share via


ConvertESXVMUsingV2VfromLibrary.ps1

Applies To: Virtual Machine Manager 2008, Virtual Machine Manager 2008 R2, Virtual Machine Manager 2008 R2 SP1

The following script uses V2V conversion to convert a VMware Server–based virtual machine in the library to a Hyper-V virtual machine. For an explanation of this script, see How to Convert Virtual Machines Using a Script.

Important

Before you convert a VMware virtual machine to a Hyper-V virtual machine in VMM, you must uninstall VMware Tools on the guest operating system of the virtual machine.

Disclaimer

# Filename:      ConvertESXVMUsingV2VfromLibrary.ps1
# Description:   Converts a VMware Server-based virtual machine stored in the 
#                library to a Hyper-V virtual machine on a host managed by VMM.

# Connect to the VMM server.
Get-VMMServer -ComputerName "VMMServer1.Contoso.com"

# Define the variables.
$VMHost = Get-VMHost -computername "VMMHost1.Contoso.com"
$VM = Get-VM -VMMServer "VMMServer1.Contoso.com" -Name "ESX Virtual Machine" | where {$_.LibraryServer.Name -eq "VMMServer1.Contoso.com"} | where {$_.Location -eq  "\\VMMServer1.Contoso.com\MSSCVMMLibrary\ESX Virtual Machine"}

# Convert the virtual machine.
New-V2V -VM $VM -VMHost $VMHost -Path "D:\VirtualMachinePath" -Name "HyperV Virtual Machine" -Description "" -Owner  "CONTOSO\phyllis" -RunAsynchronously -JobGroup 4d3514f5-1bcf-4d78-8bd1-21e6a7d0a5e4 -Trigger -CPUCount 1 -MemoryMB 256 -RunAsSystem -StartAction  NeverAutoTurnOnVM -UseHardwareAssistedVirtualization $true -StopAction TurnOffVM 

See Also

Concepts

ConvertESXVMUsingV2VfromHost.ps1