Automation

 View Only
  • 1.  Script to move vm to ressource pool without vmotion it

    Posted Jun 02, 2021 12:52 PM

    Hello,

    I write a script to move vm to ressource pool. But for each vm a vmotion is launched with the move to resource pool.

    is there a way to  move vm to ressource pool and let the VM on the host  where it was running like the Drag&Drop with the GUI?

    Here come the script ( i use -location to specify the Esxi where the vm is running but it don't do the trick).

    $vms = get-content test.txt
    $pool= Get-ResourcePool TestPool
    foreach ($vm in $vms){
    $vmloc = Get-VM $vm
    Get-VM $vm -Location $vmloc.vmhost | Move-VM -Destination $pool
    }


  • 2.  RE: Script to move vm to ressource pool without vmotion it
    Best Answer

    Posted Jun 02, 2021 04:13 PM

    There is no cmdlet for that afaik.
    You can use the MoveIntoResourcePool method, which is also what the Web Client is doing.

    Something like this

     



  • 3.  RE: Script to move vm to ressource pool without vmotion it

    Posted Jun 03, 2021 07:33 AM

    That's it, many thanks LucD

    i'm not really familiar with methods.