12 Oct 2011 @ 6:36 PM 

This is a small PowerShell script which allows you to migrate a virtual machine.
For this script to work, the Hyper-V PowerShell module has to be loaded.

#Usage: script.ps1 <vm name> <target path> <target server>
#Example: script.ps1 VM001 E:\Hyper-V Hyperv2
function MigrateVM ($VMName, $TargetPath, $TargetServer)
{
Get-VM -server $VM -vm $VMName | invoke-vmshutdown -force -Wait | Export-VM -VM $VMName -Path $TargetPath -Wait |  Get-VM -server $TargetServer -vm $VMName | Start-VM -Wait
}

Post to Twitter

Posted By: Jeff Wouters
Last Edit: 23 Apr 2012 @ 06:16 AM

EmailPermalink
Tags
Categories: Hyper-V, PowerShell, Script



Get Adobe Flash player
 Last 50 Posts
 Back
Change Theme...
  • Users » 1
  • Posts/Pages » 164
  • Comments » 150
Change Theme...
  • VoidVoid « Default
  • LifeLife
  • EarthEarth
  • WindWind
  • WaterWater
  • FireFire
  • LightLight

About



    No Child Pages.

Contact



    No Child Pages.