ConvertESXVMUsingV2VfromHost.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 virtual machine on a VMware ESX Server host to a Hyper-V virtual machine in System Center Virtual Machine Manager (VMM). 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.
# Filename: ConvertESXVMUsingV2VfromHost.ps1
# Description: Converts a virtual machine on a VMware ESX Server host to
# a Hyper-V virtual machine on a host managed by VMM.
# Define the variables.
$VMHost = Get-VMHost -VMMServer "VMMServer1.Contoso.com" | where {$_.Name -eq "VMMHost1.Contoso.com"}
$VM = Get-VM -Name "ESX Virtual Machine" | where {$_.VMHost.Name -eq "XX.XXX.XX.XXX"}
# Convert the virtual machine.
New-V2V -VM $VM -VMHost $VMHost -Path "D:\VirtualMachinePath" -Name "HyperV Virtual Machine" -Description "" -Owner "CONTOSO\phyllis" -RunAsynchronously -JobGroup 1c5728ca-a504-4477-9f55-8a7d3cffd5bf -Trigger -CPUCount 1 -MemoryMB 256 -RunAsSystem -StartAction NeverAutoTurnOnVM -UseHardwareAssistedVirtualization $true -StopAction TurnOffVM