This topic contains 3 replies, has 2 voices, and was last updated by

3 years, 3 months ago.

  • Author
  • #33688

    Points: 0
    Rank: Member

    I am planning on moving many VM's to another Hyper-V host.
    This should be pretty easy, since the vm's are running on a cluster,
    Here are the code.

    Maybe I'm making it more difficult than it is.
    Can you help me?

  • #33760

    Points: 60
    Rank: Member

    Hi Nicolai,

    Are you saying the code is not working, or just asking for comments on if your code could be neater?

  • #33763

    Points: 0
    Rank: Member

    Hi Tim.
    Sorry I confused you, the script was not working, but I made it harder than I should.
    I have now managed to fix it.

    Here is a script that Works!
    #Migrating all vm's to another host without storage.
    #Useful when the storage is on a cluster volume
    $SourceHost = "secretservername1"
    $DestinationHost = "Secretservername2"
    $VMsOnHost = Get-VM -ComputerName $SourceHost

    foreach ($VM in $VMsOnHost){
       Write-Host ("Moving "+$VM.Name)
       Move-VM -ComputerName $SourceHost -Name $VM.Name -DestinationHost $DestinationHost

  • #33764

    Points: 60
    Rank: Member

    Ah, glad to see you got it working! Didn't have a configuration i could test it on first to see.

The topic ‘Move-VM’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort