PowerCLI: vMotion Multiple VMs

KB ID 0001585

Problem

vMotioning one VM is pretty simple to do;

[box]

Get-VM VM1 | Move-VM -Destination (Get-VMHost ESX-02.pnl.com)

[/box]

And moving ALL the VMs on one host, to another is pretty straight forward also;

[box]

Get-VMHost ESX-01.pnl.com | Get-VM | Move-VM -Destination (Get-VMHost ESX-02.pnl.com)

[/box]

But what if you have a list of VMs you want to move, and you are too lazy, (sorry too skilled), do do them manually or one at a time?

Solution

Firstly get your VMs into a CSV file, in this example I’m only going to use two, drop their names into a column headed ‘Name‘.

Then use the following PowerCLI;

[box]

Import-Csv C:\Temp\VMs.csv | Foreach {Get-VM $_.Name | Move-VM -Destination (Get-VMHost ESX-02.pnl.com)}

[/box]

Then have a coffee, or stare out of the window while your work is done for you 🙂

 

Related Articles, References, Credits, or External Links

NA

VMware ESX Error “cmd addnode failed for primary node: Internal AAM error”

KB ID 0000298 

Problem

Seen in a Virtual Center HA environment – even after selecting “Reconfigure for HA” on the ESX host.

Errors:
cmd addnode failed for the primary node:Internal AAM error – agent could not start – Unknown HA error.
Cannot complete the configuration of the HA agent on the host – See the task details for additional information. Other HA configuration error.

 

Solution

1. How you proceed depends on your infrastructure. If possible, using vMotion/Migrate all the guest machines on this host, to your other ESX hosts. (Note: if that’s no an option you will need to shut down the guest machines).

2. Put the offending ESX host into maintenance mode (Right click it enter select maintenance mode).

3. Assuming you are connected to the Virtual Center, right click the offending host and select “remove”.

4. Then add it back to the cluster (Right click the cluster and select “Add Host”).

5. HA will be reconfigured on the host as its added back in.

 

Related Articles, References, Credits, or External Links

NA